Merge pull request #1295 from patricknelson/issue-1294-errorpage-fatal

FIX for #1294 to workaround ErrorPage fatal errors (and undefined var) when publishing.
This commit is contained in:
Damian Mooyman 2015-10-16 17:16:01 +13:00
commit a791ceecf5

View File

@ -222,11 +222,10 @@ class ErrorPage extends Page {
* content, so the page can be shown even when SilverStripe is not
* functioning correctly before publishing this page normally.
*
* @return void
* @return bool
*/
public function doPublish() {
parent::doPublish();
if (!parent::doPublish()) return false;
return $this->writeStaticPage();
}
@ -255,10 +254,10 @@ class ErrorPage extends Page {
$fileErrorText = _t(
'ErrorPage.ERRORFILEPROBLEM',
'Error opening file "{filename}" for writing. Please check file permissions.',
array('filename' => $errorFile)
array('filename' => $filePath)
);
$this->response->addHeader('X-Status', rawurlencode($fileErrorText));
return $this->httpError(405);
user_error($fileErrorText, E_USER_WARNING);
return false;
}
return true;
}