Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UPGRADE] Add section for CLI, improve upgrade page #1918

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions basics/keeping-up-to-date/upgrade-module/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: Upgrade Module
weight: 80
aliases:
- /1.7/development/upgrade-module/
---

# Upgrade module

Also known as the "Autoupgrade module" or the "1-click upgrade module", PrestaShop upgrade assistant aims to automatize the upgrade process.

Details on how to use the web interface are documented in [Keep up-to-date: Upgrade Assistant page]({{< ref "/1.7/basics/keeping-up-to-date/use-autoupgrade-module.md" >}}).

{{% children /%}}

## How to download it

You can download it from [the module GitHub repository](https://github.com/PrestaShop/autoupgrade/releases) or from your shop administration panel.
115 changes: 115 additions & 0 deletions basics/keeping-up-to-date/upgrade-module/upgrade-cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
title: Upgrade CLI
weight: 40
aliases:
- /1.7/development/upgrade-module/upgrade-cli
---

# Module CLI

The Autoupgrade module is accessible via `cli`. Its advantages is to be used in conjunction with a CI/CD pipeline to automate your upgrade process.
It can be aswell used manually via regular `cli` to avoid regular configuration limits on Apache or Nginx (`php-cgi`, `php-fpm` limitations such as `memory_limit`, `max_execution_time`, ...).

## Upgrade CLI

Upgrade module can be used as a Command Line Interface.

### Command line parameters

Entry point is *cli-upgrade.php* from the module's directory.
The following parameters are mandatory:

* **--dir**: Specify the admin directory name

You can also use these parameters:

* **--channel**: Specify the channel to use
* **--action**: Specify the step you want to start from

If you use default `action` parameter, it will run the full upgrade process.

Example:

```
$ php modules/autoupgrade/cli-upgrade.php --dir=admin-dev --channel=major
```

## Rollback CLI

{{% notice warning %}}
**Important**

It is not recommended to use this option. It's always better to manager your backup manually.
{{% /notice %}}

If an error occurs during the upgrade process, the rollback will be suggested.
In case you lost the page from your backoffice, note it can be triggered via CLI.

### Command line parameters

Entry point is *cli-rollback.php*.
The following parameters are mandatory:

* **--dir**: Specify the admin directory name
* **--backup**: Specify the backup name to restore (this can be found in your folder `<admin directory>/autoupgrade/backup/`)

Example:

```
$ php modules/autoupgrade/cli-rollback.php --dir=admin-dev --backup=V1.7.5.1_20190502-191341-22e883bd
```

## Full example

To upgrade your PrestaShop store to the latest version using the command line interface, follow the steps outlined below. Make sure to execute all commands from the root directory of your PrestaShop installation and replace `admin-dev` with the name of your back office directory.

### Step 1: Uninstall and remove the old autoupgrade module

1. Uninstall the old AutoUpgrade module:

`php bin/console prestashop:module uninstall autoupgrade`

2. Remove the old module's directory:

`rm -rf modules/autoupgrade`

### Step 2: Install the new autoupgrade module

1. Download the latest version of the autoupgrade module and place it in the /modules directory:

`curl -L https://github.com/PrestaShop/autoupgrade/releases/latest/download/autoupgrade.zip -o modules/autoupgrade.zip && cd modules && unzip autoupgrade.zip && cd -`

2. Install the new version of the autoupgrade module:

`php bin/console prestashop:module install autoupgrade`

### Step 3: Download the latest PrestaShop files

1. Download the latest version of PrestaShop (.zip and .xml files):

`curl -L https://github.com/PrestaShop/PrestaShop/releases/download/8.0.2/prestashop_8.0.2.zip -o admin-dev/autoupgrade/download/prestashop.zip`
`curl -L https://github.com/PrestaShop/PrestaShop/releases/download/8.0.2/prestashop_8.0.2.xml -o admin-dev/autoupgrade/download/prestashop.xml`

### Step 4: Configure the autoupgrade module

1. Create a configuration file for the AutoUpgrade module to use the local archive. Adjust the settings as needed:

`echo "{\"channel\":\"archive\",\"archive_prestashop\":\"prestashop.zip\",\"archive_num\":\"8.0.2\", \"archive_xml\":\"prestashop.xml\", \"PS_AUTOUP_CHANGE_DEFAULT_THEME\":0, \"skip_backup\": 1}" > modules/autoupgrade/config.json`


2. Apply the configuration to the `autoupgrade` module:

`php modules/autoupgrade/cli-updateconfig.php --from=modules/autoupgrade/config.json --dir=admin-dev`

### Step 5: Start the Upgrade Process


1. Initiate the upgrade process:

`php modules/autoupgrade/cli-upgrade.php --dir=admin-dev`

The upgrade process is divided into multiple parts by default. To automate the entire process, use the `testCliProcess.php` script, which runs all the steps automatically:

`php modules/autoupgrade/tests/testCliProcess.php modules/autoupgrade/cli-upgrade.php --dir=admin-dev`

By following these steps, your PrestaShop store should be successfully upgraded to the latest version.
14 changes: 14 additions & 0 deletions basics/keeping-up-to-date/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,24 @@ Learn [how to backup your shop]({{< ref "/1.7/basics/keeping-up-to-date/backup"
This chapter describes several ways to complete an upgrade of
PrestaShop.

## Upgrade assistant module (formerly 1-click upgrade module)

You can use provided `autoupgrade` module to upgrade your store to the newest version using web interface. You can read more about the module and how to use it [here]({{< ref "/1.7/basics/keeping-up-to-date/use-autoupgrade-module" >}}).

## Upgrade assistant module (formerly 1-click upgrade module) - CLI method

Upgrade assistant module (autoupgrade) is fully accessible through `cli`. You can read all the details [here]({{< ref "/1.7/basics/keeping-up-to-date/upgrade-module/upgrade-cli" >}}).

## Manual upgrade – Process details

This guide gives you the full control on the process. This one has been applied by PrestaShop for several major versions, and thus can be applied on very old shops.

{{% notice info %}}
Warning, the manual method described below only works for updates from a PrestaShop 1.7.0 store to a PrestaShop 1.7.8 one.
Wrong use of this method may render the update and the operation of your store impossible.
We recommend that you use the web interface or CLI of the Autoupgrade module.
{{% /notice %}}

### Release download

The first step is to download the latest version on https://www.prestashop.com/.
Expand Down
Loading