Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Error - publishing all pages


Go to End


1234 Views

Avatar
borriej

Community Member, 267 Posts

14 February 2011 at 8:05am

Edited: 14/02/2011 8:06am

Hello,

Im trying to publish all my page by accessing the url: www.url.com/admin/publishall

When i hit the publish all button i get the following error:


[Warning] Invalid argument supplied for foreach()
POST /sapphire/main.php?url=/admin/publishall&

Line 1247 in C:\Inetpub\vhosts\....\httpdocs\cms\code\CMSMain.php
Source

1238 		
1239 		$response = "";
1240 
1241 		if(isset($this->requestParams['confirm'])) {
1242 			$start = 0;
1243 			$pages = DataObject::get("SiteTree", "", "", "", "$start,30");
1244 			$count = 0;
1245 			if($pages){
1246 				while(true) {
1247 					foreach($pages as $page) {
1248 						if($page && !$page->canPublish()) return Security::permissionFailure($this);
1249 						
1250 						$page->doPublish();
1251 						$page->destroy();
1252 						unset($page);
1253 						$count++;

Trace

    * CMSMain->publishall(SS_HTTPRequest)
      Line 193 of Controller.php
    * Controller->handleAction(SS_HTTPRequest)
      Line 137 of RequestHandler.php
    * RequestHandler->handleRequest(SS_HTTPRequest)
      Line 147 of Controller.php
    * Controller->handleRequest(SS_HTTPRequest)
      Line 281 of Director.php
    * Director::handleRequest(SS_HTTPRequest,Session)
      Line 124 of Director.php
    * Director::direct(/admin/publishall)
      Line 127 of main.php

Why?
and what to do?