Updating Prestashop - Some Handy Hints

January 20, 2018

If you’ve read any of my previous outpourings you’ll have noticed the constant refrain of “Update early, update often.” Especially with web facing software.

Out there on the Internet an army of malicious beings waits to exploit a chink in your armour for their own nefarious purposes. Whether to spread smut, viruses or to drain the bank accounts of innocents, it’s a rough world out there. The teeming mass of malefactors will not hesitate to take advantage.

What’s worse, often it’s not even personal. “Bots” or malevolently programmed machines go out looking for a particular weakness. When the bot finds the hole it sows the seeds of havoc. Automatically.

Faced with such a never-ending onslaught, the only sensible thing is to stay tuned to the risks and keep an ear open for updates, patches, fixes, call them what you will. Having an up-to-date set-up, freshly patched against all known threats is the best way to keep the bad guys out. As I said before, mostly, it’s not personal. So anybody looking to do something bad will mostly go after the easier to hack, low hanging fruit of which there is so much. Keep your site well maintained and the bad guys will most likely go bother someone else.

That’s not to say updates themselves can’t cause problems. And if they do, you’re going to need a way back…

Updating Prestashop

What follows is based on the cumulative experience of the author. Happily there was a successful outcome. But it should be a reminder never to become blasé; always to follow the correct procedure. It may take a little extra time, but when the inevitable happens you’ll be glad you did.

The Easy Way

Those awfully nice Prestashop people have made a module called 1 Click Upgrade. It more or less does what it says on the tin. Though it’ll take more than several clicks to complete the process. If the module is installed, it’s available through the Advanced Parameters menu.

It’s a very thorough module, it will back up your files and database first. Then it downloads all the new stuff, does its thing upgrading the files and database and even creates a roll-back point to enable you to get back to where you were should the update cause unforeseen problems which prevent your online shop from working properly.

And nine times out of ten, everything works just as it should.

Tellingly, the first item under “Welcome” on the module’s page is this panel:

The Right Way and Why

Starting with the writing in bold. They’ve even put it in red so I’d take that as read that they really mean it.

The upgrade process replaces the files which contain the programs which control the shop. That’s the front end as seen by your customers. And it’s the back end where you are now, upgrading. At some point the old (working) back end is whisked away to be replaced with the new (untried) back end.

What if something goes wrong with the whisking away and the replacing process ?

You’re left without a shop, without the means of controlling it and a nice blank screen, that’s what! All the automatically created rollback points in the world won’t save you if the program to enable you to restore them doesn’t work. That rollback is meant for the sort of failure when a payment module no longer works or some aspect of the theme is fouled up. When you really need the rollback to work, the universe reminds you that for now, in this case, you are well and truly on your own, buddy.

Keep Calm

Because you followed the advice in red you:

  1. Took a copy of all the site files.
  2. And the database.
  3. And you know how to restore the site to its original state.

Don’t Panic

There’s another piece of advice underneath the eye-catching, red, bold sentence. This ought, in my opinion, to be writ even larger:

Double-check the integrity of your backup and that you can easily manually roll-back if necessary.

This means, that having made backups you should check that everything is as it should be. Check that all the files have been copied correctly. Check that the zipped download of the database is a bona-fide zip file, that it can be uncompressed and that the the uncompressed file contains proper SQL.

Because, if at this stage, your backup is sadly lacking in some unforeseen manner, then chances are you’re stuffed.

PHPMyAdmin is a semi-useful browser based tool that allows “easy” manipulation and maintenance of MySQL databases. It is entirely possible to believe that you have successfully backed up and downloaded your database, only to find that when it comes to restoring it, what you have is a corrupt mass of snarled up nonsense. It’s especially bad at zipping a file up and downloading it to you. You should download the file uncompressed and if necessary compress it locally before re-uploading.

To Sum Up

In short:

Copy and save the site files Save a copy of the database Make sure what you have saved is usable.

Then, and only then, begin the Prestashop update. And if the update fails at least you’ll have the backups to fall back on.

This has been a brief overview of the procedures and some of the possible pitfalls that can turn what should be a simple operation into a nightmare scenario. Future blogs will look at some of the specifics in more detail.