mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT #3828 500 server error page is created by default on dev/build (from r108644)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112763 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
9a036a6fad
commit
d295d682c5
@ -54,24 +54,36 @@ class ErrorPage extends Page {
|
|||||||
/**
|
/**
|
||||||
* Ensures that there is always a 404 page
|
* Ensures that there is always a 404 page
|
||||||
* by checking if there's an instance of
|
* by checking if there's an instance of
|
||||||
* ErrorPage with a 404 error code. If there
|
* ErrorPage with a 404 and 500 error code. If there
|
||||||
* is not, one is created when the DB is built.
|
* is not, one is created when the DB is built.
|
||||||
*/
|
*/
|
||||||
function requireDefaultRecords() {
|
function requireDefaultRecords() {
|
||||||
parent::requireDefaultRecords();
|
parent::requireDefaultRecords();
|
||||||
|
|
||||||
$errorPage = DataObject::get_one('ErrorPage', "\"ErrorCode\" = '404'");
|
$pageNotFoundErrorPage = DataObject::get_one('ErrorPage', "\"ErrorCode\" = '404'");
|
||||||
if(!($errorPage && $errorPage->exists())) {
|
if(!($pageNotFoundErrorPage && $pageNotFoundErrorPage->exists())) {
|
||||||
$errorpage = new ErrorPage();
|
$pageNotFoundErrorPage = new ErrorPage();
|
||||||
$errorpage->ErrorCode = 404;
|
$pageNotFoundErrorPage->ErrorCode = 404;
|
||||||
$errorpage->Title = _t('ErrorPage.DEFAULTERRORPAGETITLE', 'Page not found');
|
$pageNotFoundErrorPage->Title = _t('ErrorPage.DEFAULTERRORPAGETITLE', 'Page not found');
|
||||||
$errorpage->Content = _t('ErrorPage.DEFAULTERRORPAGECONTENT', '<p>Sorry, it seems you were trying to access a page that doesn\'t exist.</p><p>Please check the spelling of the URL you were trying to access and try again.</p>');
|
$pageNotFoundErrorPage->Content = _t('ErrorPage.DEFAULTERRORPAGECONTENT', '<p>Sorry, it seems you were trying to access a page that doesn\'t exist.</p><p>Please check the spelling of the URL you were trying to access and try again.</p>');
|
||||||
$errorpage->write();
|
$pageNotFoundErrorPage->write();
|
||||||
|
$pageNotFoundErrorPage->publish('Stage', 'Live');
|
||||||
|
|
||||||
DB::alteration_message('404 page created', 'created');
|
DB::alteration_message('404 page created', 'created');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
$serverErrorPage = DataObject::get_one('ErrorPage', "\"ErrorCode\" = '500'");
|
||||||
|
if(!($serverErrorPage && $serverErrorPage->exists())) {
|
||||||
|
$serverErrorPage = new ErrorPage();
|
||||||
|
$serverErrorPage->ErrorCode = 500;
|
||||||
|
$serverErrorPage->Title = _t('ErrorPage.DEFAULTSERVERERRORPAGETITLE', 'Server error');
|
||||||
|
$serverErrorPage->Content = _t('ErrorPage.DEFAULTSERVERERRORPAGECONTENT', '<p>Sorry, there was a problem with handling your request.</p>');
|
||||||
|
$serverErrorPage->write();
|
||||||
|
$serverErrorPage->publish('Stage', 'Live');
|
||||||
|
|
||||||
|
DB::alteration_message('500 page created', 'created');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getCMSFields() {
|
function getCMSFields() {
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user