From 2d3bb7de3e0828eb133ed020da10bfe502501474 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 16 Dec 2010 08:33:06 +0000 Subject: [PATCH] MINOR Making controller/response optional in CMSBatchAction->batchaction() in order to make the class more testable in isolation git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@115128 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/CMSBatchAction.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/code/CMSBatchAction.php b/code/CMSBatchAction.php index 56f2a0d1..51ab7c85 100644 --- a/code/CMSBatchAction.php +++ b/code/CMSBatchAction.php @@ -64,10 +64,13 @@ abstract class CMSBatchAction extends Object { unset($page); } - Controller::curr()->getResponse()->setStatusCode( - 200, - sprintf($successMessage, $pages->Count(), count($status['error'])) - ); + $response = Controller::curr()->getResponse(); + if($response) { + $response->setStatusCode( + 200, + sprintf($successMessage, $pages->Count(), count($status['error'])) + ); + } return Convert::raw2json($status); }