mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
MINOR FIX: prevents looping over an empty array
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@86166 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
966155a054
commit
85ee1007c4
@ -1102,24 +1102,25 @@ JS;
|
||||
$start = 0;
|
||||
$pages = DataObject::get("SiteTree", "", "", "", "$start,30");
|
||||
$count = 0;
|
||||
while(true) {
|
||||
foreach($pages as $page) {
|
||||
if($page && !$page->canPublish()) return Security::permissionFailure($this);
|
||||
|
||||
$page->doPublish();
|
||||
$page->destroy();
|
||||
unset($page);
|
||||
$count++;
|
||||
$response .= "<li>$count</li>";
|
||||
}
|
||||
if($pages->Count() > 29) {
|
||||
$start += 30;
|
||||
$pages = DataObject::get("SiteTree", "", "", "", "$start,30");
|
||||
} else {
|
||||
break;
|
||||
if($pages){
|
||||
while(true) {
|
||||
foreach($pages as $page) {
|
||||
if($page && !$page->canPublish()) return Security::permissionFailure($this);
|
||||
|
||||
$page->doPublish();
|
||||
$page->destroy();
|
||||
unset($page);
|
||||
$count++;
|
||||
$response .= "<li>$count</li>";
|
||||
}
|
||||
if($pages->Count() > 29) {
|
||||
$start += 30;
|
||||
$pages = DataObject::get("SiteTree", "", "", "", "$start,30");
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$response .= sprintf(_t('CMSMain.PUBPAGES',"Done: Published %d pages"), $count);
|
||||
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user