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:
Phill Price 2014-10-23 21:27:59 +01:00
parent 638b309b69
commit 7d0d84b89d

View File

@ -124,9 +124,7 @@ class BlogHolder extends BlogTree implements PermissionProvider {
// Skip creation of default records
if(!self::config()->create_default_pages) return;
$blogHolder = DataObject::get_one('BlogHolder');
//TODO: This does not check for whether this blogholder is an orphan or not
if(!$blogHolder) {
if(!BlogHolder::get()->exists()) {
$blogholder = new BlogHolder();
$blogholder->Title = "Blog";
$blogholder->URLSegment = "blog";
@ -165,6 +163,8 @@ class BlogHolder extends BlogTree implements PermissionProvider {
}
}
}
if(!BlogHolder::get()->Children()->exists()){
$blog = new BlogEntry();
$blog->Title = _t('BlogHolder.SUCTITLE', "SilverStripe blog module successfully installed");
$blog->URLSegment = 'sample-blog-entry';