In order to restore unpublished and deleted pages in Silverstripe I found this post in the Silverstripe Forums. As you need to edit the SQL statement depending on your installation and Silverstripe version, here’s the statement for the Silverstripe 2.4 version using the URLSegment.
First, find the deleted entry:
SELECT * FROM SiteTree_versions WHERE URLSegment = "your-url-segment" ORDER BY ID DESC LIMIT 1;
Second, copy the entry into the SiteTree table (replace YOUR_ID with the SiteTree_versions.ID):
INSERT INTO SiteTree (ID, Version, ClassName, Created, LastEdited, URLSegment, Title, MenuTitle, Content, MetaTitle, MetaDescription, MetaKeywords, ExtraMeta, ShowInMenus, ShowInSearch, HomepageForDomain, ProvideComments, Sort, HasBrokenFile, HasBrokenLink, STATUS, ReportClass, CanViewType, CanEditType, ToDo, Priority, ParentID, Locale) SELECT RecordID, Version, ClassName, now(), now(), URLSegment, Title, MenuTitle, Content, MetaTitle, MetaDescription, MetaKeywords, ExtraMeta, ShowInMenus, ShowInSearch, HomepageForDomain, ProvideComments, Sort, HasBrokenFile, HasBrokenLink, STATUS, ReportClass, CanViewType, CanEditType, ToDo, Priority, ParentID, Locale FROM SiteTree_versions WHERE ID = YOUR_ID;
If the deleted page has subpages, get a list of all subpage IDs and repeat the above step (replace YOUR_ID with the parent’s SiteTree_versions.RecordID):
SELECT a.* FROM SiteTree_versions a WHERE a.ParentID = YOUR_ID AND a.Version = (SELECT max(b.Version) FROM SiteTree_versions b WHERE b.RecordID = a.RecordID);
If the deleted page is a custom page (i.e. Product extends Page) and has some extra fields in it you’ll need to copy that too into the required table (Rreplace YOUR_ID with the SiteTree_Versions.ID):
INSERT INTO Product (ID, Name, Description) SELECT RecordID, Name, Description FROM Product_versions WHERE ID = (SELECT max(ID) FROM Product_versions WHERE RecordID = (SELECT RecordID FROM SiteTree_versions WHERE ID = YOUR_ID));