Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
-
The site existed in Web Presence Builder and was published to the domain.
-
The site was accidentally removed from Web Presence Builder (WPB) by clicking on either More > Start Over or More > Remove Site.
Is it possible to restore the site from the domain example.com?
Answer
The site can be restored from a snapshot located in the /data/snapshots
directory of the domain where it was published.
When a new site for the domain is created, old snapshots are not shown in Web Presence Builder, even if the files exist in the file system. This is because the name of the main XML file contains the ID of the old site. To show old snapshots for new sites, it is necessary to rename the XML file:
-
Connect to the server via SSH and check snapshot name:
# ls -la /var/www/vhosts/example.com/httpdocs/data/snapshots/
total 252
-rw-r--r-- 1 testcust psacln 223 Jul 1 13:34 03a21c5dbeaf22159bc109374638f61f_list.xml
-rw-r--r-- 1 testcust psacln 250139 Jul 1 13:34 3b395edf0050931a8632de93a4d3085a.phpHere,
03a21c5dbeaf22159bc109374638f61f
is the ID of the old site that was published to the domainexample.com
. -
Create a new instance of the WPB site for the domain
example.com
via Plesk in Domains > example.com > Edit in Web Presence Builder.Warning: Do not publish the site yet.
-
Find the Site ID by the name of the Plesk domain:
# plesk db
mysql> select d.name as 'Plesk Domain', s.uuid as 'Site uuid', s.site_id as 'Site ID' from psa.domains d, psa.dom_param dp, sitebuilder5.site s where d.id=dp.dom_id and dp.param='site_builder_site_id' and s.uuid=dp.val and d.name='example.com';
+--------------+--------------------------------------+----------------------------------+
| Plesk Domain | Site uuid | Site ID |
+--------------+--------------------------------------+----------------------------------+
| example.com | d116751c-458c-5179-3f57-142135a67b3c | 172bc09617fa3dcafded8e53377097d5 |
+--------------+--------------------------------------+----------------------------------+ -
Rename the XML file to make it fit the new Site ID:
# mv /var/www/vhosts/example.mom/httpdocs/data/snapshots/03a21c5dbeaf22159bc109374638f61f_list.xml /var/www/vhosts/example.com/httpdocs/data/snapshots/172bc09617fa3dcafded8e53377097d5_list.xml
-
Refresh the page with the new site instance. Snapshots should be shown on the "Revert" page. As soon as they are available in WPB, you can restore them by clicking Load.
Note: After the snapshot is restored, there may be additional issues with site images because they have the old location paths in the WPB database. As a result, they may not be visible in the restored site.
To solve this, re-upload the images or change the paths in the database:
# mysqldump --disable-extended-insert sitebuilder5 > sb_backup.sql
# grep "03a21c5dbeaf22159bc109374638f61f" sb_backup.sql | grep widget_property
INSERT INTO widget_property
VALUES (570,462,'content','<p><img id=\"mce-548\" style=\"float: left; margin-right: 20px;\" title=\"helloworld\" src=\"/sitebuilder/sites/03/03a21c5dbeaf22159bc109374638f61f/attachments/Image/helloworld.jpg\" alt=\"helloworld\" width=\"1631\" height=\"743\" /></p>');
Find the strings with the old paths and replace them with the new values. For example, change /sitebuilder/sites/03/03a21c5dbeaf22159bc109374638f61f/attachments/Image/helloworld.jpg
to /sitebuilder/sites/17/172bc09617fa3dcafded8e53377097d5/attachments/Image/helloworld.jpg
.
-
Connect to the server via RDP
-
Check the snapshot name at
%plesk_vhosts%example.com\httpdocs\data\snapshots
, e.g.03a21c5dbeaf22159bc109374638f61f_list.xml
, where03a21c5dbeaf22159bc109374638f61f
is the ID of the old site that was published to the domainexample.com
-
Create a new instance of the WPB site for the domain example.com via Plesk in Domains > example.com > Edit in Web Presence Builder
Note: Do not publish the site yet.
-
Find the Site ID by the name of the Plesk domain: to access sitebuilder5 database on Windows, execute the following command via the command line:
"%plesk_dir%\MySQL\bin\mysql.exe" -D sitebuilder5 -usitebuilder -p<sitebuilder_password> -P 3306
The
sitebuilder_password
is located in the%plesk_dir%\sb\config
file. -
Execute the following command for
example.com
:mysql> select uuid,site_id from site where site_publish_settings_id=(select id from site_publish_settings where url like "%example.com%") \G
*************************** 1. row ***************************
uuid: 39ce7af2-a526-42e6-e3f6-2b04377c47e7
site_id: afdef54d44d8be6d83df5bd6ab10a157The site ID is
afdef54d44d8be6d83df5bd6ab10a157
-
Rename the XML file from
%plesk_vhosts%example.com\httpdocs\data\snapshots
directory to make it fit the new Site ID -
Refresh the page with the new site instance. Snapshots should be shown on the "Revert" page. As soon as they are available in WPB, you can restore them by clicking Load.
Note: After the snapshot is restored, there may be additional issues with site images because they have the old location paths in the WPB database. As a result, they may not be visible in the restored site. To solve this, re-upload the images or change the paths in the database:
-
Create a sitebuider database dump:
"%plesk_dir%\Mysql\bin\mysqldump.exe" -usitebuilder -p<sitebuilder_password> -P 3306 sitebuilder5 > C:\FULL\PATH\TO\FILE_NAME.sql
-
Open the dump in any text editor and change the old paths and replace them with the new values. For example, change
/sitebuilder/sites/03/03a21c5dbeaf22159bc109374638f61f/attachments/Image/helloworld.jpg
to/sitebuilder/sites/17/172bc09617fa3dcafded8e53377097d5/attachments/Image/helloworld.jpg
.
When changing the name of the xml file to match with site ID, it would be convenient to cat the xml file and make sure the correct php file is in the <file> tag. The xml file should look like this:
# cat /var/www/vhosts/example.com/httpdocs/data/snapshots/4a00c5ed8bf2eae83d8d3beb254799dc_list.xml
<?xml version="1.0" encoding="utf-8"?>
<snapshots>
<snapshot id="0">
<file>ec8ec994e46cfa161aac48ef9558b2c1.php</file>
<title>TestSnapshot</title>
<date>1523632319</date>
</snapshot>
</snapshots>
Comments
2 comments
Hi Leonid Gukhman,
It's not clear for me, what are the differences between three types of site/domain backing up:
1) The Plesk Toolks --> Backup
2) The WordPress Toolkit 'Back Up / Restore' per domain
And the most unclear of all...
3) Snapshots file which may generated leaving the "Restore Point" box checked, while syncing from one domain to another, which may be seen in 'root' folder: '.wp-toolkit/snapshots'
@Ehud Ziegelman my location: It explains that even though the site may have been accidentally removed from Web Presence Builder, it is possible to restore it by accessing the snapshot files in the domain's /data/snapshots directory. The key is to rename the main XML file to match the new site ID. This is a useful troubleshooting tip for anyone who has accidentally deleted a WPB site and needs to recover it.
Please sign in to leave a comment.