mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Recover if a manifestClassParse file doesn't have the necessary content. (from r101866)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112043 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c5c7dee5f0
commit
3ba0434d6d
@ -418,10 +418,20 @@ class ManifestBuilder {
|
|||||||
// were upgrading their sites
|
// were upgrading their sites
|
||||||
$fileMD5 = md5($file);
|
$fileMD5 = md5($file);
|
||||||
$parseCacheFile = TEMP_FOLDER . "/manifestClassParse-" . str_replace(array("/", ":", "\\", "."), "_", basename($filename)) . "-$fileMD5";
|
$parseCacheFile = TEMP_FOLDER . "/manifestClassParse-" . str_replace(array("/", ":", "\\", "."), "_", basename($filename)) . "-$fileMD5";
|
||||||
if(!file_exists($parseCacheFile)) {
|
if(file_exists($parseCacheFile)) {
|
||||||
|
include($parseCacheFile);
|
||||||
|
// Check for a bad cache file
|
||||||
|
if(!isset($classes) || !isset($interfaces) || !is_array($classes) || !is_array($interfaces)) {
|
||||||
|
unset($classes);
|
||||||
|
unset($interfaces);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Either the parseCacheFile doesn't exist, or its bad
|
||||||
|
if(!isset($classes)) {
|
||||||
$tokens = token_get_all($file);
|
$tokens = token_get_all($file);
|
||||||
$classes = self::getClassDefParser()->findAll($tokens);
|
$classes = (array)self::getClassDefParser()->findAll($tokens);
|
||||||
$interfaces = self::getInterfaceDefParser()->findAll($tokens);
|
$interfaces = (array)self::getInterfaceDefParser()->findAll($tokens);
|
||||||
|
|
||||||
$cacheContent = '<?php
|
$cacheContent = '<?php
|
||||||
$classes = ' . var_export($classes,true) . ';
|
$classes = ' . var_export($classes,true) . ';
|
||||||
@ -431,9 +441,6 @@ class ManifestBuilder {
|
|||||||
fwrite($fh, $cacheContent);
|
fwrite($fh, $cacheContent);
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
include($parseCacheFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($classes as $class) {
|
foreach($classes as $class) {
|
||||||
@ -456,7 +463,7 @@ class ManifestBuilder {
|
|||||||
|
|
||||||
self::$classArray[$className] = $class;
|
self::$classArray[$className] = $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($interfaces as $interface) {
|
foreach($interfaces as $interface) {
|
||||||
$className = $interface['interfaceName'];
|
$className = $interface['interfaceName'];
|
||||||
unset($interface['interfaceName']);
|
unset($interface['interfaceName']);
|
||||||
|
Loading…
Reference in New Issue
Block a user