mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-04 16:51:25 +02:00
BUGFIX: Recover if a manifestClassParse file doesn't have the necessary content.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@101866 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
04299df886
commit
4864553aca
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user