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

"Orphan" pages in SiteTree


Go to End


4 Posts   1857 Views

Avatar
Double-A-Ron

Community Member, 607 Posts

5 May 2009 at 1:46pm

Edited: 05/05/2009 2:30pm

Hi all,

I had an issue where a page I was creating for a site was appending "-12" to the URL even if I removed it manually. I knew this meant there was a conflicting URL in the system.

I checked it out in the SiteTree table and found the conflicting page. I got it's Parent number in an attempt to find out where it was and found that the Parent ID did not exist in either SiteTree or SiteTree_Live.

So I wrote a little script to check this out by getting all the pages from SiteTree and check that their ParentID exists in turn (except for ParentID of 0). I found litteraly dozens of "Orphan" pages in the system.

So a few questions:
1. Anyone know how something like this happens?
2. Is there a /dev/build function or the likes for cleaning this up?
3. If no to 2., is there any reason why I shouldn't use this script to remove this orphans. e.g. Could their parents be in another table perhaps?

Cheers
Aaron

Avatar
rbquirke

Community Member, 70 Posts

5 May 2009 at 2:31pm

Hmm, I'm going to have to do an orphan pages report for a client soon, so I'm interested in the topic.

It isn't anything to do with page histories/revisions is it?

Avatar
Double-A-Ron

Community Member, 607 Posts

5 May 2009 at 2:57pm

Edited: 05/05/2009 2:57pm

Don't think so.

I find these pages in SiteTree, and they don't appear to have 'real' parents in SiteTree, SiteTree_Live or SiteTree_versions.

I've attached the code I used to clean a test copy of the site in question. All seems well so far. Just basic Run of the mill PHP in there. Couldn't be knackered working Sapphire into this.

Aaron

Avatar
rbquirke

Community Member, 70 Posts

5 May 2009 at 3:15pm

Cheers.

I will update this thread with my code if the client goes ahead with getting the report.....