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
This commit is contained in:
Sam Minnee 2008-10-16 03:21:49 +00:00
parent b0abb54e93
commit 156fb6cf19

View File

@ -541,11 +541,8 @@ JS;
public function revert($urlParams, $form) { public function revert($urlParams, $form) {
$id = $_REQUEST['ID']; $id = $_REQUEST['ID'];
Versioned::reading_stage('Live');
$obj = DataObject::get_by_id("SiteTree", $id); $obj = DataObject::get_by_id("SiteTree", $id);
Versioned::reading_stage('Stage'); $obj->doRevertToLive();
$obj->publish("Live", "Stage");
$title = Convert::raw2js($obj->Title); $title = Convert::raw2js($obj->Title);
FormResponse::get_page($id); FormResponse::get_page($id);
@ -758,15 +755,8 @@ HTML;
$SQL_id = Convert::raw2sql($_REQUEST['ID']); $SQL_id = Convert::raw2sql($_REQUEST['ID']);
$page = DataObject::get_by_id("SiteTree", $SQL_id); $page = DataObject::get_by_id("SiteTree", $SQL_id);
$page->deleteFromStage('Live'); $page->doUnpublish();
$page->flushCache();
$page = DataObject::get_by_id("SiteTree", $SQL_id);
$page->Status = "Unpublished";
$page->write();
GoogleSitemap::ping();
return $this->tellBrowserAboutPublicationChange($page, sprintf(_t('CMSMain.REMOVEDPAGE',"Removed '%s' from the published site"),$page->Title)); 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) { function performRollback($id, $version) {
$record = DataObject::get_by_id($this->stat('tree_class'), $id); $record = DataObject::get_by_id($this->stat('tree_class'), $id);
$record->publish($version, "Stage", true); $record->doRollbackTo($version);
$record->AssignedToID = 0;
$record->RequestedByID = 0;
$record->Status = "Saved (update)";
$record->writeWithoutVersion();
return $record; return $record;
} }