From c33022f987f4bd208d5d9d184214c9711dc3301e Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Fri, 30 Oct 2009 03:27:27 +0000 Subject: [PATCH] MINOR fix failing tests git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@90509 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/CMSBatchAction.php | 8 ++++++-- code/CMSBatchActionHandler.php | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/code/CMSBatchAction.php b/code/CMSBatchAction.php index 27945e1f..33c56dc9 100644 --- a/code/CMSBatchAction.php +++ b/code/CMSBatchAction.php @@ -39,10 +39,14 @@ abstract class CMSBatchAction extends Object { * @para */ public function batchaction(DataObjectSet $pages, $helperMethod, $successMessage, $arguments = array()) { + $failures = 0; + foreach($pages as $page) { // Perform the action - call_user_func_array(array($page, $helperMethod), $arguments); + if (!call_user_func_array(array($page, $helperMethod), $arguments)) { + $failures++; + } // Now make sure the tree title is appropriately updated $publishedRecord = DataObject::get_by_id('SiteTree', $page->ID); @@ -126,7 +130,7 @@ class CMSBatchAction_Delete extends CMSBatchAction { unset($page); } - $message = sprintf(_t('CMSBatchActions.DELETED_PAGES', 'Deleted %d pages from the draft site, %d failures'), $pages->Count()-$failures, $failures); + $message = sprintf(_t('CMSBatchActions.DELETED_PAGES', 'Deleted %d pages from the draft site'), $pages->Count()); FormResponse::add('statusMessage("'.$message.'","good");'); return FormResponse::respond(); diff --git a/code/CMSBatchActionHandler.php b/code/CMSBatchActionHandler.php index 75bb9a75..640b78b4 100644 --- a/code/CMSBatchActionHandler.php +++ b/code/CMSBatchActionHandler.php @@ -8,7 +8,6 @@ class CMSBatchActionHandler extends RequestHandler { static $batch_actions = array( 'publish' => 'CMSBatchAction_Publish', - 'unpublish' => 'CMSBatchAction_Unpublish', 'delete' => 'CMSBatchAction_Delete', 'deletefromlive' => 'CMSBatchAction_DeleteFromLive', );