Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MINOR Making controller/response optional in CMSBatchAction->batchact…

…ion() 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
  • Loading branch information...
commit 2d3bb7de3e0828eb133ed020da10bfe502501474 1 parent 2afc2e9
@chillu chillu authored
Showing with 7 additions and 4 deletions.
  1. +7 −4 code/CMSBatchAction.php
View
11 code/CMSBatchAction.php
@@ -64,10 +64,13 @@ public function batchaction(DataObjectSet $pages, $helperMethod, $successMessage
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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.