From efe710e2d30c6cff8599a76de2b24f315b53a088 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 16 Mar 2011 13:30:55 +1300 Subject: [PATCH] MINOR Removed unnecessary SiteTree->Status setting in ContentController, ErrorPage and SiteTree - now controlled via getters like isPublished() --- core/control/ContentController.php | 1 - core/model/ErrorPage.php | 2 -- core/model/SiteTree.php | 5 ----- 3 files changed, 8 deletions(-) diff --git a/core/control/ContentController.php b/core/control/ContentController.php index 342b1c39e..a2d14f7bd 100755 --- a/core/control/ContentController.php +++ b/core/control/ContentController.php @@ -431,7 +431,6 @@ HTML; // The manifest should be built by now, so it's safe to publish the 404 page $fourohfour = Versioned::get_one_by_stage('ErrorPage', 'Stage', '"ErrorCode" = 404'); if($fourohfour) { - $fourohfour->Status = "Published"; $fourohfour->write(); $fourohfour->publish("Stage", "Live"); } diff --git a/core/model/ErrorPage.php b/core/model/ErrorPage.php index 8a4fdc0ba..fa00e2898 100755 --- a/core/model/ErrorPage.php +++ b/core/model/ErrorPage.php @@ -74,7 +74,6 @@ class ErrorPage extends Page { $pageNotFoundErrorPage->ErrorCode = 404; $pageNotFoundErrorPage->Title = _t('ErrorPage.DEFAULTERRORPAGETITLE', 'Page not found'); $pageNotFoundErrorPage->Content = _t('ErrorPage.DEFAULTERRORPAGECONTENT', '

Sorry, it seems you were trying to access a page that doesn\'t exist.

Please check the spelling of the URL you were trying to access and try again.

'); - $pageNotFoundErrorPage->Status = 'New page'; $pageNotFoundErrorPage->write(); $pageNotFoundErrorPage->publish('Stage', 'Live'); } @@ -102,7 +101,6 @@ class ErrorPage extends Page { $serverErrorPage->ErrorCode = 500; $serverErrorPage->Title = _t('ErrorPage.DEFAULTSERVERERRORPAGETITLE', 'Server error'); $serverErrorPage->Content = _t('ErrorPage.DEFAULTSERVERERRORPAGECONTENT', '

Sorry, there was a problem with handling your request.

'); - $serverErrorPage->Status = 'New page'; $serverErrorPage->write(); $serverErrorPage->publish('Stage', 'Live'); } diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index 9a21f53b3..5d3c77762 100755 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -1297,7 +1297,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $homepage->Title = _t('SiteTree.DEFAULTHOMETITLE', 'Home'); $homepage->Content = _t('SiteTree.DEFAULTHOMECONTENT', '

Welcome to SilverStripe! This is the default homepage. You can edit this page by opening the CMS. You can now access the developer documentation, or begin the tutorials.

'); $homepage->URLSegment = 'home'; - $homepage->Status = 'Published'; $homepage->Sort = 1; $homepage->write(); $homepage->publish('Stage', 'Live'); @@ -1309,7 +1308,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $aboutus = new Page(); $aboutus->Title = _t('SiteTree.DEFAULTABOUTTITLE', 'About Us'); $aboutus->Content = _t('SiteTree.DEFAULTABOUTCONTENT', '

You can fill this page out with your own content, or delete it and create your own pages.

'); - $aboutus->Status = 'Published'; $aboutus->Sort = 2; $aboutus->write(); $aboutus->publish('Stage', 'Live'); @@ -1319,7 +1317,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $contactus = new Page(); $contactus->Title = _t('SiteTree.DEFAULTCONTACTTITLE', 'Contact Us'); $contactus->Content = _t('SiteTree.DEFAULTCONTACTCONTENT', '

You can fill this page out with your own content, or delete it and create your own pages.

'); - $contactus->Status = 'Published'; $contactus->Sort = 3; $contactus->write(); $contactus->publish('Stage', 'Live'); @@ -2028,7 +2025,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid // Handle activities undertaken by decorators $this->invokeWithExtensions('onBeforePublish', $original); - $this->Status = "Published"; //$this->PublishedByID = Member::currentUser()->ID; $this->write(); $this->publish("Stage", "Live"); @@ -2119,7 +2115,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid // Otherwise, these lines will resurrect an inappropriate record if(DB::query("SELECT \"ID\" FROM \"SiteTree\" WHERE \"ID\" = $this->ID")->value() && Versioned::current_stage() != 'Live') { - $this->Status = "Unpublished"; $this->write(); }