Jump to:

17645 Posts in 4594 Topics by 2177 members

General Questions

SilverStripe Forums » General Questions » Restore Unpublished and Deleted Pages

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

Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba

Page: 1
Go to End
Author Topic: 1646 Views
  • wakes
    Avatar
    Community Member
    7 Posts

    Restore Unpublished and Deleted Pages Link to this post

    Hi, just a quick tip on how to restore an unpublished/deleted Page which no longer shows in the SiteTree:

    In your DB client of choice (e.g. phpMyAdmin) locate the previous to last version of the page in the SiteTree_versions table (e.g. by Title, ClassName, URLSegment etc) and note down the ID of that record. It will probably have a status of 'Published' or 'Saved' (not the last record for that page which will probably have a status of 'Unpublished'). e.g.

    select * from SiteTree_versions where Title = '<page title>' and ClassName = '<page class>' order by ID desc limit 1, 1;

    Execute the following in the SQL client, providing the ID of the record above:

    insert into SiteTree (ID, Version, ClassName, Created, LastEdited, URLSegment, Title, Content, MetaTitle, ShowInMenus, ShowInSearch, Sort, Status, Priority, Viewers, Editors, ViewersGroup, EditorsGroup, ParentID)
    select RecordID, Version, ClassName, now(), now(), URLSegment, Title, Content, MetaTitle, ShowInMenus, ShowInSearch, Sort, Status, Priority, Viewers, Editors, ViewersGroup, EditorsGroup, ParentID
    from SiteTree_versions where ID = <id of the record>;

    This will restore the page (and all children!) to the SiteTree in the CMS, from where you can then re-publish it.

  • Taffy
    Avatar
    Community Member
    119 Posts

    Re: Restore Unpublished and Deleted Pages Link to this post

    Nice one. It would be good if you put it on Aram's http://ssbits.com/ site

  • PapaBear
    Avatar
    Community Member
    26 Posts

    Re: Restore Unpublished and Deleted Pages Link to this post

    I have just had the panicked call from a client who had discovered their staff member had made some huge changes to important pages and then accidentally erased the entire sub-tree (half a dozen pages or so). Using this technique I was able to roll back to the previous delivered version of the pages without damaging the rest of the site and have their site restored in under an hour. Very happy client. Very happy web-developer.

    Thank you!

    James.

  • Catchgraphics
    Avatar
    Community Member
    12 Posts

    Re: Restore Unpublished and Deleted Pages Link to this post

    Hi I followed the instructions but I get the following error:

    Error

    SQL query: Documentation

    INSERT INTO SiteTree( ID, Version, ClassName, Created, LastEdited, URLSegment, Title, Content, MetaTitle, ShowInMenus, ShowInSearch, Sort,
    STATUS , Priority, Viewers, Editors, ViewersGroup, EditorsGroup, ParentID )
    SELECT RecordID, Version, ClassName, now( ) , now( ) , URLSegment, Title, Content, MetaTitle, ShowInMenus, ShowInSearch, Sort,
    STATUS , Priority, Viewers, Editors, ViewersGroup, EditorsGroup, ParentID
    FROM SiteTree_versions
    WHERE ID =3

    MySQL said: Documentation
    #1054 - Unknown column 'Priority' in 'field list'

    There seems to be a problem with the " now(), now()," part. As I don't really know any sql I am not sure if I have done anything wrong. Help would be much appreciated.

    Many thanks

    Michael

  • wakes
    Avatar
    Community Member
    7 Posts

    Re: Restore Unpublished and Deleted Pages Link to this post

    The actual column names may vary some due to different versions/modules etc installed. If you do a 'show columns from SiteTree_versions;' in mysql administrator tool (e.g. phpmyadmin, command line) then it will give you a list of columns which you'll need to use for your particular setup.

    If you have problems please post the output of the 'show columns from SiteTree_versions;' command and I'll have a look.

    1646 Views
Page: 1
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.