mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR ErrorPage removal of ShowInMenus explicitly being set - this is done using static $defaults on the class itself.
MINOR ErrorPage phpDoc updates - removal of non-existant token @usedby, replaced with @see MINOR Code formatting changes to be more consistent git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64502 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
9025c57e4b
commit
ee5b0e2447
@ -7,8 +7,9 @@
|
|||||||
* This enables us to show errors even if PHP experiences a recoverable error.
|
* This enables us to show errors even if PHP experiences a recoverable error.
|
||||||
* ErrorPages
|
* ErrorPages
|
||||||
*
|
*
|
||||||
|
* @see Debug::friendlyError()
|
||||||
|
*
|
||||||
* @package cms
|
* @package cms
|
||||||
* @usedby Debug::friendlyError()
|
|
||||||
*/
|
*/
|
||||||
class ErrorPage extends Page {
|
class ErrorPage extends Page {
|
||||||
|
|
||||||
@ -22,24 +23,24 @@ 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
|
||||||
|
* ErrorPage with a 404 error code. If there
|
||||||
|
* is not, one is created when the DB is built.
|
||||||
*/
|
*/
|
||||||
function requireDefaultRecords() {
|
function requireDefaultRecords() {
|
||||||
parent::requireDefaultRecords();
|
parent::requireDefaultRecords();
|
||||||
|
|
||||||
if(!DataObject::get_one("ErrorPage", "ErrorCode = '404'")) {
|
if(!DataObject::get_one('ErrorPage', "ErrorCode = '404'")) {
|
||||||
$errorpage = new ErrorPage();
|
$errorpage = new ErrorPage();
|
||||||
$errorpage->ErrorCode = 404;
|
$errorpage->ErrorCode = 404;
|
||||||
$errorpage->Title = _t('ErrorPage.DEFAULTERRORPAGETITLE', 'Page not found');
|
$errorpage->Title = _t('ErrorPage.DEFAULTERRORPAGETITLE', 'Page not found');
|
||||||
$errorpage->URLSegment = "page-not-found";
|
$errorpage->URLSegment = 'page-not-found';
|
||||||
$errorpage->ShowInMenus = false;
|
|
||||||
$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>');
|
$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>');
|
||||||
$errorpage->Status = "New page";
|
$errorpage->Status = 'New page';
|
||||||
$errorpage->write();
|
$errorpage->write();
|
||||||
// Don't publish, as the manifest may not be built yet
|
|
||||||
// $errorpage->publish("Stage", "Live");
|
|
||||||
|
|
||||||
Database::alteration_message("404 page created","created");
|
Database::alteration_message('404 page created', 'created');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user