Upgrade process steps

All these steps are called from the entrypoint ajax-upgradetab.php (or from upgrade-cli.php when in a CLI context).

stateDiagram-v2 [*] --> UpgradeNow UpgradeNow --> Download Download --> Unzip UpgradeNow --> Unzip : Personal Archive Unzip --> RemoveSamples UpgradeNow --> RemoveSamples : Unzipped folder RemoveSamples --> BackupFiles BackupFiles --> BackupDb BackupDb --> UpgradeFiles UpgradeFiles --> UpgradeDb UpgradeDb --> UpgradeModules UpgradeModules --> CleanDatabase CleanDatabase --> UpgradeComplete UpgradeComplete --> [*]

Upgrade

The following steps will be executed during the upgrade:

  1. UpgradeNow: Start of the whole process. The next step will be chosen depending on the configuration.
  2. Download: Download the proper archive depending on the selected channel
  3. Unzip: Unzip the downloaded archive
  4. RemoveSamples: This step removes the example files (example products, orders, customers, …) from the downloaded archive
  5. BackupFiles: In case the upgrade fails, or if the merchant wants to rollback later, it saves the files of the shop. Note this can be filtered, for example if a file is too large.
  6. BackupDb: It saves the current database structure and content, in case a rollback is needed.
  7. UpgradeFiles: Now the current content is saved, it can alter the shop content. This step will run several time. The first call will initialize the files list, then the next ones will copy a part of this list.
  8. UpgradeDb: This step runs all the upgrade SQL files available in the install folder. Then, it will run some additional steps, such as theme enabling, cache deletion, language update…
  9. UpgradeModules: With the list downloaded from the PrestaShop Marketplace in the first steps, it now requests updated module zips and updates the installed ones.
  10. CleanDatabase: This step run some SQL queries in order to remove obsolete or wrong data. Note the concerned data is not coming from the upgrade itself, but from the use of PrestaShop.
  11. UpgradeComplete: This step will display a success message and will end the process.

Rollback

stateDiagram-v2 [*] --> Rollback Rollback --> RollbackFiles RollbackFiles --> RollbackDb RollbackDb --> RollbackComplete Rollback --> NoRollbackFound : Error
  1. Rollback: This is the entrypoint of the rollback process. It will find all the available backups regarding the given parameters (basically, the restore backup must be sent from the backup name you generated). If a backup matches the given parameters, the process starts the file restoration.
  2. NoRollbackFound: A classic task used to display a message saying no backup matches the given parameters, and terminates the process.
  3. RollbackFiles: Like the step UpgradeFiles, this step copies the files from the archive and remove the files missing from the original environment.
  4. RollbackDb: This task reads and runs the files generated by BackupDb.
  5. RollbackComplete: The upgrade may have failed or the user was not completely satisfied by the new version. The shop was rollbacked in its initial state.

Other

These steps don’t follow any process and are independent between each others.

  • CheckFilesVersion: This task is responsible to detect all local files has been modified by the merchant / developer. This is an important pre-requisite which warn about the potential loss of changes.
  • Error: This task can be called from any other one, and will display a specific message saying the upgrade / restore process failed. In case of upgrade, a restore will be suggested.
  • UpdateConfig: This task will store in a configuration file the different options selected in the web version of the module.