From 96fee2a03119ca03b3da866d99e82a78e671bac6 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Fri, 18 Jan 2008 02:35:39 +0000 Subject: [PATCH] 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 --- code/CMSMain.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/code/CMSMain.php b/code/CMSMain.php index ad9adac5..f6ce4d68 100644 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -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 "
  • $count"; + while(true) { + foreach($pages as $page) { + $this->performPublish($page); + $page->destroy(); + unset($page); + $count++; + echo "
  • $count
  • "; + } + if($pages->Count() > 29) { + $start += 30; + $pages = DataObject::get("SiteTree", "", "", "", "$start,30"); + } else { + break; + } } echo sprintf(_t('CMSMain.PUBPAGES',"Done: Published %d pages"), $count);