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 |
-
Restore Unpublished and Deleted Pages

13 May 2009 at 12:55pm
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.
-
Re: Restore Unpublished and Deleted Pages

13 May 2009 at 9:13pm
Nice one. It would be good if you put it on Aram's http://ssbits.com/ site
-
Re: Restore Unpublished and Deleted Pages

5 May 2010 at 4:13pm
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.
-
Re: Restore Unpublished and Deleted Pages

14 August 2010 at 9:47pm
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 =3MySQL 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
-
Re: Restore Unpublished and Deleted Pages

14 August 2010 at 9:55pm
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 |




