mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Update BlogHolder.php
Amended to 3x version of finding an object exists. Split children out as part of the TODO to see if orphan
This commit is contained in:
parent
638b309b69
commit
7d0d84b89d
@ -124,9 +124,7 @@ class BlogHolder extends BlogTree implements PermissionProvider {
|
|||||||
// Skip creation of default records
|
// Skip creation of default records
|
||||||
if(!self::config()->create_default_pages) return;
|
if(!self::config()->create_default_pages) return;
|
||||||
|
|
||||||
$blogHolder = DataObject::get_one('BlogHolder');
|
if(!BlogHolder::get()->exists()) {
|
||||||
//TODO: This does not check for whether this blogholder is an orphan or not
|
|
||||||
if(!$blogHolder) {
|
|
||||||
$blogholder = new BlogHolder();
|
$blogholder = new BlogHolder();
|
||||||
$blogholder->Title = "Blog";
|
$blogholder->Title = "Blog";
|
||||||
$blogholder->URLSegment = "blog";
|
$blogholder->URLSegment = "blog";
|
||||||
@ -165,6 +163,8 @@ class BlogHolder extends BlogTree implements PermissionProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(!BlogHolder::get()->Children()->exists()){
|
||||||
$blog = new BlogEntry();
|
$blog = new BlogEntry();
|
||||||
$blog->Title = _t('BlogHolder.SUCTITLE', "SilverStripe blog module successfully installed");
|
$blog->Title = _t('BlogHolder.SUCTITLE', "SilverStripe blog module successfully installed");
|
||||||
$blog->URLSegment = 'sample-blog-entry';
|
$blog->URLSegment = 'sample-blog-entry';
|
||||||
|
Loading…
Reference in New Issue
Block a user