FIX Avoid get_parent_class in ConfigStaticManifest (was loading all classes)

This commit is contained in:
Hamish Friedlander 2013-03-12 16:52:11 +13:00
parent 943b5cf3a4
commit 7f58730904

View File

@ -63,7 +63,7 @@ class SS_ConfigStaticManifest {
if (isset($this->index[$class])) { if (isset($this->index[$class])) {
$info = $this->index[$class]; $info = $this->index[$class];
if ($details = $this->cache->load($this->key.'_'.$info['base'])) { if ($details = $this->cache->load($this->key.'_'.$info['key'])) {
$this->statics += $details; $this->statics += $details;
} }
@ -109,33 +109,26 @@ class SS_ConfigStaticManifest {
if($cache) { if($cache) {
$index = array('$statics' => array()); $index = array('$statics' => array());
$bases = array(); $keysets = array();
foreach ($this->statics as $class => $details) { foreach ($this->statics as $class => $details) {
if (in_array($class, self::$initial_classes)) { if (in_array($class, self::$initial_classes)) {
$index['$statics'][$class] = $details; $index['$statics'][$class] = $details;
} }
else { else {
$base = $class; $key = sha1($class);
$keysets[$key][$class] = $details;
do {
$parent = get_parent_class($base);
}
while ($parent != 'Object' && $parent != 'ViewableData' && $parent && ($base = $parent));
$base = sha1($base);
$bases[$base][$class] = $details;
$index[$class] = array( $index[$class] = array(
'base' => $base, 'key' => $key,
'path' => $details['path'], 'path' => $details['path'],
'mtime' => filemtime($details['path']), 'mtime' => filemtime($details['path']),
); );
} }
} }
foreach ($bases as $base => $details) { foreach ($keysets as $key => $details) {
$this->cache->save($details, $this->key.'_'.$base); $this->cache->save($details, $this->key.'_'.$key);
} }
$this->cache->save($index, $this->key); $this->cache->save($index, $this->key);