Jump to:

1153 Posts in 2568 Topics by 408 members

Upgrading SilverStripe

SilverStripe Forums » Upgrading SilverStripe » Bug : "Junk Pages" in SiteTree

Ask questions about upgrading SilverStripe to the latest version.

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

Page: 1 2
Go to End
Author Topic: 2779 Views
  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Bug : "Junk Pages" in SiteTree Link to this post

    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
  • Taffy
    Avatar
    Community Member
    119 Posts

    Re: Bug : "Junk Pages" in SiteTree Link to this post

    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.

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Bug : "Junk Pages" in SiteTree Link to this post

    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.

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Bug : "Junk Pages" in SiteTree Link to this post

    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.

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Bug : "Junk Pages" in SiteTree Link to this post

    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.

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Bug : "Junk Pages" in SiteTree Link to this post

    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 ....

  • TomJaimz
    Avatar
    Community Member
    2 Posts

    Re: Bug : "Junk Pages" in SiteTree Link to this post

    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?

  • apiening
    Avatar
    Community Member
    55 Posts

    Re: Bug : "Junk Pages" in SiteTree Link to this post

    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

    2779 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.