Login | Forgot password | Register

X

What is OpenID?

OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.

With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.

For more information visit the official OpenID site.

Jump to:

457 Posts in 123 Topics by 165 members

Upgrading SilverStripe

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

Ask questions about upgrading SilverStripe to the latest version.

Page: 1
Go to End
Author Topic: Bug : "Junk Pages" in SiteTree 814 Views
  • Fuzz10
    avatar
    Community Member
    760 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
    107 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
    485 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
    Administrator
    596 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
    485 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
    760 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 ....

    814 Views
Page: 1
Go to Top

Currently Online: ikhwanb, Lee, holy noli

Welcome to our latest member: holy noli

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

Comments on this website? Please give feedback.