mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
API CHANGE: Added SiteTree::get_create_default_pages().MINOR: Error pages no longer created on /dev/build if SiteTree::get_create_default_pages() is false. Fixes #6587.
This commit is contained in:
parent
446b8bae63
commit
c9b5ae8b41
@ -63,6 +63,7 @@ class ErrorPage extends Page {
|
|||||||
function requireDefaultRecords() {
|
function requireDefaultRecords() {
|
||||||
parent::requireDefaultRecords();
|
parent::requireDefaultRecords();
|
||||||
|
|
||||||
|
if ($this->class == 'ErrorPage' && SiteTree::get_create_default_pages()) {
|
||||||
// Ensure that an assets path exists before we do any error page creation
|
// Ensure that an assets path exists before we do any error page creation
|
||||||
if(!file_exists(ASSETS_PATH)) {
|
if(!file_exists(ASSETS_PATH)) {
|
||||||
mkdir(ASSETS_PATH);
|
mkdir(ASSETS_PATH);
|
||||||
@ -122,6 +123,7 @@ class ErrorPage extends Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getCMSFields() {
|
function getCMSFields() {
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
|
@ -228,6 +228,15 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
self::$create_default_pages = $option;
|
self::$create_default_pages = $option;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if default pages should be created on /dev/build.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function get_create_default_pages() {
|
||||||
|
return self::$create_default_pages;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the {@link SiteTree} object that maps to a link.
|
* Fetches the {@link SiteTree} object that maps to a link.
|
||||||
*
|
*
|
||||||
@ -1291,7 +1300,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
parent::requireDefaultRecords();
|
parent::requireDefaultRecords();
|
||||||
|
|
||||||
// default pages
|
// default pages
|
||||||
if($this->class == 'SiteTree' && self::$create_default_pages) {
|
if($this->class == 'SiteTree' && self::get_create_default_pages()) {
|
||||||
if(!SiteTree::get_by_link('home')) {
|
if(!SiteTree::get_by_link('home')) {
|
||||||
$homepage = new Page();
|
$homepage = new Page();
|
||||||
$homepage->Title = _t('SiteTree.DEFAULTHOMETITLE', 'Home');
|
$homepage->Title = _t('SiteTree.DEFAULTHOMETITLE', 'Home');
|
||||||
|
Loading…
Reference in New Issue
Block a user