wakeless: #2144 - More memory-efficient version of admin/publishall

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@48235 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-01-18 02:35:39 +00:00
parent b00e1ca72e
commit 96fee2a031

View File

@ -1137,14 +1137,23 @@ HTML;
ini_set('max_execution_time', 300);
if(isset($_POST['confirm'])) {
$pages = DataObject::get("SiteTree");
$start = 0;
$pages = DataObject::get("SiteTree", "", "", "", "$start,30");
$count = 0;
foreach($pages as $page) {
$this->performPublish($page);
$page->destroy();
unset($page);
$count++;
echo "<li>$count";
while(true) {
foreach($pages as $page) {
$this->performPublish($page);
$page->destroy();
unset($page);
$count++;
echo "<li>$count</li>";
}
if($pages->Count() > 29) {
$start += 30;
$pages = DataObject::get("SiteTree", "", "", "", "$start,30");
} else {
break;
}
}
echo sprintf(_t('CMSMain.PUBPAGES',"Done: Published %d pages"), $count);