MINOR fix failing tests

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@90509 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Tom Rix 2009-10-30 03:27:27 +00:00
parent 1d281472ab
commit c33022f987
2 changed files with 6 additions and 3 deletions

View File

@ -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();

View File

@ -8,7 +8,6 @@
class CMSBatchActionHandler extends RequestHandler {
static $batch_actions = array(
'publish' => 'CMSBatchAction_Publish',
'unpublish' => 'CMSBatchAction_Unpublish',
'delete' => 'CMSBatchAction_Delete',
'deletefromlive' => 'CMSBatchAction_DeleteFromLive',
);