Eric Dolou (Broceliande on the forum) and Michael Marinetti (PrestaShop) have worked together on the new functionality OCU.
For this collaboration, they configured a private subversion repository, and made many unformal meetings (IRC, Skype or mails).
The OCU function allows the upgrade of a PrestaShop 1.4.4.x and above to the last stable version in one click.
More than upgrading, this feature make a full backup (files and datas), in order to restore your website. This is the rollback feature.
To make this possible, some core classes have been modified. For example, Backup.php can now save the database in a custom directory. The new Upgrader class is now a convenient way to know if a new version is available and to download it on the server.
Numerous methods have been implemented in the AdminUpgrade class, and some will be moved in core classes. For example, we talked about a class Restore.
Eventually, these methods will be available for everyone and would be directly used in theirs modules.
This first version has been built around the following functions:
- download, unzip et removeSamples: Download the last stable version, extract it and delete samples images.
- backupFiles: backup of a directory and all its subdirectories. (i.e.: website tree... ). Options are available to exclude specific directories like pictures in order to make the backup.
- backupDb: backup the whole database.
- upgradeFiles: Overwrite old core files and replace them by the new ones.
- upgradeDb: Upgrade the database by using the same methods as the standard installer.
- Rollback: Allow the restoration of files and database if the user is not completely satisfied by the upgrade (theme problems for example). Before restoring files, all new files are deleted with the _cleanUp function to avoid all problems we can have.
Numerous improvements are planned for the next: a version named « Standalone » (to upgrade in one click from 1.3.x ), an unstable mode to download the version in current development from the official subversion repository, and many more...
In a conclusion, this teamwork has been very profitable to both of us, and maybe this will encourage other people to contribute even more to core of PrestaShop.
Co-written by Eric Dolou and Michaël Marinetti