From 500ce4a91d7608d4a2d6586b46824a82c7dce148 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 15 Oct 2009 22:24:41 +0000 Subject: [PATCH] MINOR added better status reporting to batch actions. Will now report the correct number of pages actioned in the status message (from r88786) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89185 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/SiteTree.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index 8d3917a41..5aa7f6adc 100755 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -1804,6 +1804,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid * @uses SiteTreeDecorator->onAfterPublish() */ function doPublish() { + if (!$this->canPublish()) return false; + $original = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $this->ID"); if(!$original) $original = new SiteTree(); @@ -1875,6 +1877,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid * @uses SiteTreeDecorator->onAfterUnpublish() */ function doUnpublish() { + if (!$this->canPublish()) return false; + $this->extend('onBeforeUnpublish'); // Call delete on a cloned object so that this one doesn't lose its ID