On a production site, we are having to proceed for a batch update of plugins. It is possible that the site stops to work properly because of a plugin clash. My question is: If I make a backup of the plugin folder, will that be enough to perform a total restore in case of problems?
2 Answers
You need to also back up the database in addition to the plugins folder. Not only is information stored in the database about which versions of which plugins are installed, an updated plugin itself may make changes to its settings which is stores in the database.
Without backing up both the database AND the plugins folder, you wouldn't be able to rollback from a bad update.
Ideally, you should use a staging server for testing updates.
Regardless of whether you use a staging server or a production server, I recommend that you learn to use WP CLI. This makes backups and updates much easier, especially if you need to roll back from something that doesn't work.
By using WP CLI, you can export your entire database with a single command - wp db export
. Then you can zip the entire site (which will include the db backup) - zip -r mysite_backup.zip *
.
At that point, you've got a backup of your db AND every file/folder on your site from which you could completely restore your site to the pre-update state.
(BTW, you can also use WP CLI to batch update the plugins with wp plugin update --all
. You can also use it to roll back an individual plugin to a previous version if necessary - wp plugin update my-cool-plugin --version=1.2.3
)
No. You should always backup FTP (in this case plugins folder could suffice) and database.
Although many prominent plugins do not change the database on the update (and instead ask you to run them manually or schedule an automated event for that), you cannot be sure that every plugin does it like this.
Personally I prefer running the updates on a staging instance (which is basically a clone of the current live one). Then there is time to test and see if stuff breaks. If stuff breaks to a point where you can't recover anymore, just kill the instance and create a new clone of live.
Once that staging environment has been tested and we know the updates work, run this specific plugin updates on production. (There may be more recent version of plugins, to avoid getting them, I run plugin updates with WP CLI and pin to specific versions.)