From 156fb6cf1990b80e0d16b780b51fbf4839e54531 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 16 Oct 2008 03:21:49 +0000 Subject: [PATCH] API CHANGE #551: Move code from CMSMain to SiteTree git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@64350 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/CMSMain.php | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/code/CMSMain.php b/code/CMSMain.php index 6d16679c..9e8fa783 100644 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -541,11 +541,8 @@ JS; public function revert($urlParams, $form) { $id = $_REQUEST['ID']; - - Versioned::reading_stage('Live'); $obj = DataObject::get_by_id("SiteTree", $id); - Versioned::reading_stage('Stage'); - $obj->publish("Live", "Stage"); + $obj->doRevertToLive(); $title = Convert::raw2js($obj->Title); FormResponse::get_page($id); @@ -758,15 +755,8 @@ HTML; $SQL_id = Convert::raw2sql($_REQUEST['ID']); $page = DataObject::get_by_id("SiteTree", $SQL_id); - $page->deleteFromStage('Live'); - $page->flushCache(); - - $page = DataObject::get_by_id("SiteTree", $SQL_id); - $page->Status = "Unpublished"; - $page->write(); - - GoogleSitemap::ping(); - + $page->doUnpublish(); + return $this->tellBrowserAboutPublicationChange($page, sprintf(_t('CMSMain.REMOVEDPAGE',"Removed '%s' from the published site"),$page->Title)); } @@ -805,11 +795,7 @@ HTML; function performRollback($id, $version) { $record = DataObject::get_by_id($this->stat('tree_class'), $id); - $record->publish($version, "Stage", true); - $record->AssignedToID = 0; - $record->RequestedByID = 0; - $record->Status = "Saved (update)"; - $record->writeWithoutVersion(); + $record->doRollbackTo($version); return $record; }