diff --git a/code/CMSMain.php b/code/CMSMain.php
index b7d65d8e..5125a513 100755
--- a/code/CMSMain.php
+++ b/code/CMSMain.php
@@ -1251,23 +1251,21 @@ JS;
$start = 0;
$pages = DataObject::get("SiteTree", "", "", "", "$start,30");
$count = 0;
- if($pages){
- while(true) {
- foreach($pages as $page) {
- if($page && !$page->canPublish()) return Security::permissionFailure($this);
-
- $page->doPublish();
- $page->destroy();
- unset($page);
- $count++;
- $response .= "
$count";
- }
- if($pages->Count() > 29) {
- $start += 30;
- $pages = DataObject::get("SiteTree", "", "", "", "$start,30");
- } else {
- break;
- }
+ while($pages) {
+ foreach($pages as $page) {
+ if($page && !$page->canPublish()) return Security::permissionFailure($this);
+
+ $page->doPublish();
+ $page->destroy();
+ unset($page);
+ $count++;
+ $response .= "$count";
+ }
+ if($pages->Count() > 29) {
+ $start += 30;
+ $pages = DataObject::get("SiteTree", "", "", "", "$start,30");
+ } else {
+ break;
}
}
$response .= sprintf(_t('CMSMain.PUBPAGES',"Done: Published %d pages"), $count);
diff --git a/tests/CMSMainTest.php b/tests/CMSMainTest.php
index 4736ee13..6c535a61 100644
--- a/tests/CMSMainTest.php
+++ b/tests/CMSMainTest.php
@@ -38,7 +38,7 @@ class CMSMainTest extends FunctionalTest {
$response = $this->get("admin/cms/publishall?confirm=1");
$this->assertContains(
- sprintf(_t('CMSMain.PUBPAGES',"Done: Published %d pages"), 8),
+ sprintf(_t('CMSMain.PUBPAGES',"Done: Published %d pages"), 30),
$response->getBody()
);
@@ -225,4 +225,4 @@ class CMSMainTest extends FunctionalTest {
// TODO Logout
$this->session()->inst_set('loggedInAs', NULL);
}
-}
\ No newline at end of file
+}
diff --git a/tests/CMSMainTest.yml b/tests/CMSMainTest.yml
index 87409f25..d87515a8 100644
--- a/tests/CMSMainTest.yml
+++ b/tests/CMSMainTest.yml
@@ -13,6 +13,50 @@ Page:
Parent: =>Page.page3
page4:
Title: Page 4
+ page5:
+ Title: Page 5
+ page6:
+ Title: Page 6
+ page7:
+ Title: Page 7
+ page8:
+ Title: Page 8
+ page9:
+ Title: Page 9
+ page10:
+ Title: Page 10
+ page11:
+ Title: Page 11
+ page12:
+ Title: Page 12
+ page13:
+ Title: Page 13
+ page14:
+ Title: Page 14
+ page15:
+ Title: Page 15
+ page16:
+ Title: Page 16
+ page17:
+ Title: Page 17
+ page18:
+ Title: Page 18
+ page19:
+ Title: Page 19
+ page20:
+ Title: Page 20
+ page21:
+ Title: Page 21
+ page22:
+ Title: Page 22
+ page23:
+ Title: Page 23
+ page24:
+ Title: Page 24
+ page25:
+ Title: Page 25
+ page26:
+ Title: Page 26
home:
Title: Home
URLSegment: home
@@ -82,4 +126,4 @@ RedirectorPage:
page5:
Title: Page 5
RedirectionType: External
- ExternalURL: http://www.google.com
\ No newline at end of file
+ ExternalURL: http://www.google.com