mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-04 15:18:39 +02:00
BUGFIX: Fixed file-write testing issues in requirements combined file generation
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@100982 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
f057d60adc
commit
3f3c2b2fe9
@ -911,14 +911,23 @@ class Requirements_Backend {
|
|||||||
// Process the combined files
|
// Process the combined files
|
||||||
$base = Director::baseFolder() . '/';
|
$base = Director::baseFolder() . '/';
|
||||||
foreach(array_diff_key($combinedFiles, $this->blocked) as $combinedFile => $dummy) {
|
foreach(array_diff_key($combinedFiles, $this->blocked) as $combinedFile => $dummy) {
|
||||||
if(!is_writable($base . $combinedFile)) {
|
|
||||||
user_error("Requirements_Backend::process_combined_files(): Couldn't create '$base$combinedFile'", E_USER_WARNING);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$fileList = $this->combine_files[$combinedFile];
|
$fileList = $this->combine_files[$combinedFile];
|
||||||
$combinedFilePath = $base . $this->combinedFilesFolder . '/' . $combinedFile;
|
$combinedFilePath = $base . $this->combinedFilesFolder . '/' . $combinedFile;
|
||||||
|
|
||||||
|
|
||||||
|
// Make the folder if necessary
|
||||||
|
if(!file_exists(dirname($combinedFilePath))) {
|
||||||
|
Filesystem::makeFolder(dirname($combinedFilePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the file isn't writebale, don't even bother trying to make the combined file
|
||||||
|
// Complex test because is_writable fails if the file doesn't exist yet.
|
||||||
|
if((file_exists($combinedFilePath) && !is_writable($combinedFilePath)) ||
|
||||||
|
(!file_exists($combinedFilePath) && !is_writable(dirname($combinedFilePath)))) {
|
||||||
|
user_error("Requirements_Backend::process_combined_files(): Couldn't create '$combinedFilePath'", E_USER_WARNING);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Determine if we need to build the combined include
|
// Determine if we need to build the combined include
|
||||||
if(file_exists($combinedFilePath) && !isset($_GET['flush'])) {
|
if(file_exists($combinedFilePath) && !isset($_GET['flush'])) {
|
||||||
// file exists, check modification date of every contained file
|
// file exists, check modification date of every contained file
|
||||||
@ -950,10 +959,6 @@ class Requirements_Backend {
|
|||||||
$combinedData .= "/****** FILE: $file *****/\n" . $fileContent . "\n".($isJS ? ';' : '')."\n";
|
$combinedData .= "/****** FILE: $file *****/\n" . $fileContent . "\n".($isJS ? ';' : '')."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!file_exists(dirname($combinedFilePath))) {
|
|
||||||
Filesystem::makeFolder(dirname($combinedFilePath));
|
|
||||||
}
|
|
||||||
|
|
||||||
$successfulWrite = false;
|
$successfulWrite = false;
|
||||||
$fh = fopen($combinedFilePath, 'wb');
|
$fh = fopen($combinedFilePath, 'wb');
|
||||||
if($fh) {
|
if($fh) {
|
||||||
@ -965,7 +970,7 @@ class Requirements_Backend {
|
|||||||
// Unsuccessful write - just include the regular JS files, rather than the combined one
|
// Unsuccessful write - just include the regular JS files, rather than the combined one
|
||||||
if(!$successfulWrite) {
|
if(!$successfulWrite) {
|
||||||
user_error("Requirements_Backend::process_combined_files(): Couldn't create '$combinedFilePath'", E_USER_WARNING);
|
user_error("Requirements_Backend::process_combined_files(): Couldn't create '$combinedFilePath'", E_USER_WARNING);
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user