mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX TemplateManifest prevent cache collision
This commit is contained in:
parent
4ea2d99cbf
commit
807755f002
@ -38,11 +38,35 @@ class SS_TemplateManifest {
|
|||||||
$cacheClass = defined('SS_MANIFESTCACHE') ? SS_MANIFESTCACHE : 'ManifestCache_File';
|
$cacheClass = defined('SS_MANIFESTCACHE') ? SS_MANIFESTCACHE : 'ManifestCache_File';
|
||||||
|
|
||||||
$this->cache = new $cacheClass('templatemanifest'.($includeTests ? '_tests' : ''));
|
$this->cache = new $cacheClass('templatemanifest'.($includeTests ? '_tests' : ''));
|
||||||
$this->cacheKey = 'manifest';
|
$this->cacheKey = $this->getCacheKey($includeTests);
|
||||||
|
|
||||||
$this->forceRegen = $forceRegen;
|
$this->forceRegen = $forceRegen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getBase() {
|
||||||
|
return $this->base;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a unique cache key to avoid manifest cache collisions.
|
||||||
|
* We compartmentalise based on the base path, the given project, and whether
|
||||||
|
* or not we intend to include tests.
|
||||||
|
* @param boolean $includeTests
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCacheKey($includeTests = false) {
|
||||||
|
return sha1(sprintf(
|
||||||
|
"manifest-%s-%s-%s",
|
||||||
|
$this->base,
|
||||||
|
$this->project,
|
||||||
|
(int) $includeTests // cast true to 1, false to 0
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a map of all template information. The map is in the following
|
* Returns a map of all template information. The map is in the following
|
||||||
* format:
|
* format:
|
||||||
|
Loading…
Reference in New Issue
Block a user