mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR If the error-404.html or error-500.html file can't be opened, supress the warning so an error isn't shown in the CMS
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@70188 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
efde576662
commit
ec5ed83512
@ -100,11 +100,17 @@ class ErrorPage extends Page {
|
||||
$response = Director::test(Director::makeRelative($this->Link()));
|
||||
$errorContent = $response->getBody();
|
||||
|
||||
// Check we have an assets base directory, creating if it we don't
|
||||
if(!file_exists(ASSETS_PATH)) {
|
||||
mkdir(ASSETS_PATH, 02775);
|
||||
}
|
||||
|
||||
if($fh = fopen(ASSETS_PATH . "/error-$this->ErrorCode.html", "w")) {
|
||||
// Path to the error file in the file store
|
||||
$errorFile = ASSETS_PATH . "/error-$this->ErrorCode.html";
|
||||
|
||||
// Attempt to open the file, writing it if it doesn't exist
|
||||
$fh = @fopen($errorFile, "w");
|
||||
if($fh) {
|
||||
fwrite($fh, $errorContent);
|
||||
fclose($fh);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user