API CHANGE: Added SiteTree::doDeleteFromLive()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@76723 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-05-13 05:13:20 +00:00
parent 8c24a42cb8
commit c05728ad30

View File

@ -697,12 +697,12 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
// if page can't be edited, don't grant delete permissions
if(!$this->canEdit($member)) return false;
$children = $this->AllChildren();
if($children) foreach($children as $child) {
if(!$child->canDelete($member)) return false;
}
return $this->stat('can_create') != false;
}
@ -1520,6 +1520,13 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
return $result;
}
function doDeleteFromLive() {
$origStage = Versioned::current_stage();
Versioned::reading_stage('Live');
$this->delete();
Versioned::reading_stage($origStage);
}
/**
* Check if this page is new - that is, if it has yet to have been written