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.

Upgrading SilverStripe /

Ask questions about upgrading SilverStripe to the latest version.

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

Bug : "Junk Pages" in SiteTree


Go to End


9 Posts   5046 Views

Avatar
Fuzz10

Community Member, 791 Posts

25 March 2009 at 2:03am

Edited: 25/03/2009 2:04am

Now that I have a couple of sites running for a while , it seems the "Lingering junk pages" problem in the site-tree is getting worse.

Trying to find a way to reproduce the bug, but it is pretty hard. It has something to do with removing and/or dragging pages around in the Sitetree. In the CMS , I can't select the pages to remove them (I get an "error loading page" error) .

When I look in the siteTree DB tables. There are empty records for the Pages in both Sitetree and SiteTree_Live. If I remove them both , the pages will disappear (of course). But the problem keeps coming back.

See the screenshots for an example.

Are there more people who encountered this problem ?

Attached Files
Avatar
Taffy

Community Member, 119 Posts

25 March 2009 at 3:56am

I haven't encountered this with SS sorry.

Sounds similar to a bug with a commercial CMS I used a while ago. Some random deleted pages would show up on menus and not in the CMS. They could be found in the database without a parent page id and were referred to as orphaned pages.

Avatar
Carbon Crayon

Community Member, 598 Posts

25 March 2009 at 9:32am

yea I've come accross this before, but can't for the life of me remember the conditions when it happened. I don't usually get that many though, usually one or two obove the home page in the tree.

Avatar
Ingo

Forum Moderator, 801 Posts

29 March 2009 at 2:37pm

I can confirm this problem exists, seen it before as well. Mainly when a save fails halfway through, leaving inconsistent ORM<->DB state, or when you manually mess with the database in unexpected ways, e.g. just deleting a database row from one of the three related tables. Changing classnames or removing PHP classes which still have database records might be a cause as well.

Would be great to get this reproducible if you want to put a bit of effort into trying out the combinations. We could do some integrity checks on pages before displaying them - for starters make sure they have a title, or otherwise generate one by default.

Avatar
Carbon Crayon

Community Member, 598 Posts

30 March 2009 at 3:46am

Edited: 30/03/2009 3:49am

Hi Ingo

I have found a condition udner which this happens when using onAfterWrite.

I create a page which creates a child page automatically. Then if I publish the parent page first I get a junk page appear above it, however if i publishe the child page and then the parent page everything is fine.

The function I am using in Page.php to generate the child page is:

	function onAfterWrite(){
		if(!$this->Children()->count()){
		$cp = new TestPage();
     		$cp->ParentID = $this->ID;
     		$cp->Title = "Test Page";
      		$cp->write(); 
		} 
	}

The reason I use ->count() on the end of the if is that for some reason $this->children() returns true in this context even when there are no children so it doesnt create the desired child page.

Anyway the strange part comes when I use the batch button to delete the junk pages, they suddenly turn into normal pages that have been draft deleted and can then be opened as normal.

Hope that helps :)

EDIT: Also another bug/sideeffect when using onAfterWrite to create child pages is that when you 'duplicate this page and children' on a page like this it then creates another child page as well as the duplicated one.

Avatar
Fuzz10

Community Member, 791 Posts

30 April 2009 at 1:14am

Have been testing but did not find a reproducable situation yet.

My feeling tells me dragging pages around in the site-tree has something to do with it as well (creating parents, making parents childs etc.) ... This is in line with Aram's post above....

I'll keep an eye out ....

Avatar
TomJaimz

Community Member, 2 Posts

10 June 2010 at 11:59am

Hello all, apologies for the bump but I've just started with SilverStripe, running through the demo, and I've noticed this issue occurring on my installation.

Was there ever a solution found for it (as this thread is a year old). Is there an easy way of purging the junk pages - I'm using an SQLite DB but I'm not sure how exactly I interface with it - any ideas?

Avatar
apiening

Community Member, 60 Posts

11 June 2010 at 11:47am

hi TomJaimz,

i don't know anything about the shadow pages but i know a good SQLite client: try SQLite Manager Plugin for Firefox
http://code.google.com/p/sqlite-manager/

Cheers

Andy

Go to Top