From 7d0d84b89dd5c898f96e177c078af066aaef800d Mon Sep 17 00:00:00 2001 From: Phill Price Date: Thu, 23 Oct 2014 21:27:59 +0100 Subject: [PATCH] Update BlogHolder.php Amended to 3x version of finding an object exists. Split children out as part of the TODO to see if orphan --- code/BlogHolder.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 48edefc..f6a0b0d 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -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';