mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
MINOR added batch deletion back for workflow (from r88916) (from r96789)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@102481 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
3df78fd493
commit
791dc22e5d
@ -44,7 +44,6 @@ abstract class CMSBatchAction extends Object {
|
|||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
public function batchaction(DataObjectSet $pages, $helperMethod, $successMessage, $arguments = array()) {
|
public function batchaction(DataObjectSet $pages, $helperMethod, $successMessage, $arguments = array()) {
|
||||||
$failures = 0;
|
|
||||||
$status = array('modified' => array(), 'error' => array());
|
$status = array('modified' => array(), 'error' => array());
|
||||||
|
|
||||||
foreach($pages as $page) {
|
foreach($pages as $page) {
|
||||||
@ -129,7 +128,8 @@ class CMSBatchAction_Delete extends CMSBatchAction {
|
|||||||
function run(DataObjectSet $pages) {
|
function run(DataObjectSet $pages) {
|
||||||
$status = array(
|
$status = array(
|
||||||
'modified'=>array(),
|
'modified'=>array(),
|
||||||
'deleted'=>array()
|
'deleted'=>array(),
|
||||||
|
'error'=>array()
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($pages as $page) {
|
foreach($pages as $page) {
|
||||||
@ -137,6 +137,7 @@ class CMSBatchAction_Delete extends CMSBatchAction {
|
|||||||
|
|
||||||
// Perform the action
|
// Perform the action
|
||||||
if($page->canDelete()) $page->delete();
|
if($page->canDelete()) $page->delete();
|
||||||
|
else $status['error'][$page->ID] = true;
|
||||||
|
|
||||||
// check to see if the record exists on the live site,
|
// check to see if the record exists on the live site,
|
||||||
// if it doesn't remove the tree node
|
// if it doesn't remove the tree node
|
||||||
@ -179,7 +180,7 @@ class CMSBatchAction_DeleteFromLive extends CMSBatchAction {
|
|||||||
// Perform the action
|
// Perform the action
|
||||||
if($page->canDelete()) $page->doDeleteFromLive();
|
if($page->canDelete()) $page->doDeleteFromLive();
|
||||||
|
|
||||||
// check to see if the record exists on the live site, if it doesn't remove the tree node
|
// check to see if the record exists on the stage site, if it doesn't remove the tree node
|
||||||
$stageRecord = Versioned::get_one_by_stage( 'SiteTree', 'Stage', "\"SiteTree\".\"ID\"=$id");
|
$stageRecord = Versioned::get_one_by_stage( 'SiteTree', 'Stage', "\"SiteTree\".\"ID\"=$id");
|
||||||
if($stageRecord) {
|
if($stageRecord) {
|
||||||
$stageRecord->IsAddedToStage = true;
|
$stageRecord->IsAddedToStage = true;
|
||||||
@ -191,8 +192,15 @@ class CMSBatchAction_DeleteFromLive extends CMSBatchAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
<<<<<<< .working
|
||||||
|
|
||||||
return Convert::raw2json($status);
|
return Convert::raw2json($status);
|
||||||
|
=======
|
||||||
|
|
||||||
|
return FormResponse::respond();
|
||||||
|
>>>>>>> .merge-right.r96789
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user