Restoring backed-up versions / rolling-back plugins

One of the most useful features of WordShell is that it retains backups of all previous versions of plugins. Every time you update or remove a plugin, a copy is stored for later usage, in case you need to roll back.

WordShell also keeps a cached copy of the plugins from present live site. So if your live site is lost (hacked, deleted, etc.), then you can restore all the present plugins from the backup easily.

Rolling back and restoring

WordShell has two separate modes, which it is helpful to understand the difference between:

  1. Restore, activated using –restore : this mode simply copies the existing local cache back to the live site. Therefore, if the live site was intact and had not been modified outside of WordShell, then this operation does nothing (it simply copies the same files that were already live). It is only useful for if you have damaged plugins and wish to restore them.
  2. Rollback, activated using –rollback : this mode is to replace the existing plugin with a previously removed (either through deletion or updating) version. You would use this if the new version of the plugin turns out to be faulty and you want to move back to a previously-working version.


If you wish to restore WordShell’s current backup to the live site, then simply specify which plugins (or all) and use the –restore switch;

wordshell mysite akismet --restore

or for all plugins on a site:

wordshell mysite all --restore

WARNING: Many WordShell commands will automatically re-sync the current cache of the live site. If your live site is damaged, then this will result in the damage being copied into WordShell’s copy, and you will lose your opportunity to restore. Therefore, if you have a situation where a restore is needed, then you should do the restore operation before doing anything else, or else run all other commands with the –cache switch to prevent the local version being over-ridden. To be extra-sure, you could back-up your local WordShell directory (which by default is ~/.wordshell).

You can also restore to a different location – which is in effect, cloning your site. You do this by specifying a parameter, e.g.:

wordshell mysite akismet --restore=/path/to/new/directory
wordshell mysite akismet --restore=ftp://myuser:[email protected]/new/path


To roll back a plugin to a previously installed version, use –rollback. If you specify no parameter, then the most recently installed version (other than the current version) will be used:

wordshell mysite contact-form-7 --rollback

However, you can also specify a value, which should be the time to roll back to. WordShell will then roll back to the version installed at that time. The time can be in any format supported by your system’s “date” binary, e.g.:

wordshell mysite contact-form-7 --rollback='1 day ago'

wordshell mysite contact-form-7 --rollback='4 Apr 2012'

wordshell mysite contact-form-7 --rollback='last Tuesday'

Type “man date” for more information on what dates can be entered on your system.

Available versions for rollback

To show what versions are available for rolling back, use –listrollbacks:

wordshell mysite wp-updates-notifier --listrollbacks

Example output:

mysite wp-updates-notifier 1.2 Sat 31 Mar 2012 10:44:15 AM BST
mysite wp-updates-notifier 1.3 Mon 23 Apr 2012 10:09:55 AM BST

Or for all plugins on the site:

wordshell mysite --listrollbacks

Example output:
mysite akismet 2.5.5 Thu 26 Apr 2012 10:53:14 AM BST
mysite contact-form-7 3.1.1 Thu 19 Apr 2012 12:57:46 PM BST
mysite wp-updates-notifier 1.2 Sat 31 Mar 2012 10:44:15 AM BST
mysite wp-updates-notifier 1.3 Mon 23 Apr 2012 10:09:55 AM BST

Using other tools

If you make changes to your WordPress site outside of WordShell, then WordShell will not be able to retain the backups. Therefore, for full version control, it is recommended that you only operate on your WordPress site using WordShell, unless you are sure that you do not need to retain change history.

Purging old backups

You can delete old rollbacks by using –deleterollbacks. By default it will delete stored rollbacks older than 90 days; or you can specify a value, e.g.:

Delete all rollback versions of akismet on all sites older than 70 days:

wordshell all akismet --deleterollbacks=70

Delete all rollback versions on a particular site older than (the default) 90 days:

wordshell mysite --deleterollbacks

Note however that if WordShell has cached a copy of the pristine (unmodified) zip file for a particular plugin version, then all rollbacks that match that version will simply be stored as links, so very little storage space is used. So if 25 sites all use the same plugin, unmodified, then when you upgrade no extra storage is used to store the rollbacks.

Next read:

Leave a Reply