Permalink
Browse files

BUGFIX Convert pages from DataList to ArrayList in CMSBatchActionHand…

…ler to avoid problems on merge()
  • Loading branch information...
1 parent d04fe07 commit 64db811d653d6e2de2c83f9f36b0f8168a964555 @chillu chillu committed Mar 8, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 admin/code/CMSBatchActionHandler.php
@@ -111,8 +111,14 @@ function handleAction($request) {
implode(", ", $idsFromLive)
);
$livePages = Versioned::get_by_stage($this->recordClass, 'Live', $sql);
- if($pages) $pages->merge($livePages);
- else $pages = $livePages;
+ if($pages) {
+ // Can't merge into a DataList, need to condense into an actual list first
+ // (which will retrieve all records as objects, so its an expensive operation)
+ $pages = new ArrayList($pages->toArray());
+ $pages->merge($livePages);
+ } else {
+ $pages = $livePages;
+ }
}
}
} else {

0 comments on commit 64db811

Please sign in to comment.