Mettre à jour Lizmap Web Client

Mettre à jour depuis Lizmap 2.x

Voir documentation de Lizmap 3.1 <https://docs.lizmap.com/3.1/en/install/upgrade.html> _.

Mettre à jour à partir d’une version de Lizmap inférieure à 3.5

You should first migrate to 3.5. See documentation of Lizmap 3.5.

Upgrading to Lizmap 3.10

Before upgrading to Lizmap 3.10, check these points:

  • PHP 8.2 is now the minimum version. Upgrade PHP first if needed, read Installing necessary packages.

  • QGIS Server 3.40 is now the minimum version.

  • Lizmap configuration files with a target version lower than 3.7 are not displayed anymore on the landing page. They are still listed in the administration panel with a warning. Open them with a recent version of the Lizmap plugin in QGIS desktop and save them again.

The upgrade itself is done with the usual steps described below (backup, replace files, launch the installer).

After the upgrade:

  • The storage format of the tile cache has changed: the cache directory, or the Sqlite file, of a layer is now named with a hash of the layer name. A cache generated before the upgrade is not used anymore. You must generate the cache again (read Gestion du cache en tant qu’administrateur). The old cache is not deleted automatically: you can remove it with the command php lizmap/console.php wmts:cache:clean repository project, which removes the whole cache of a project, or remove the old directories by hand.

  • Tiles in WebP format are now stored as WebP in the cache (they were stored as JPEG before). If some layers use the WebP format with the server cache, clear their cache.

  • The installer creates a new permalink table, used to store short permalinks (read Short permalink), and a new right Manage server side permalinks for administrators.

  • The user interface now uses Bootstrap 5 instead of Bootstrap 2. If you have written your own JavaScript, CSS themes or templates, check them, read Ajouter votre propre JavaScript and Créer des thèmes simples.

  • For developers of additional modules, some old PHP classes have been removed: lizmapRepository (use \Lizmap\Project\Repository), lizmapOGCRequest (use \Lizmap\Request\OGCRequest), lizmapProxy (use \Lizmap\Request\Proxy), qgisServer and qgisProject. The classes lizmapProject (use \Lizmap\Project\Project) and lizmapWkt (use \Lizmap\App\WktTools) are deprecated.

Mise à jour de la version 3.5 ou 3.6 de Lizmap

Here is how to upgrade.

First, you must install PHP and Composer (apt install composer in Debian, or install by hand from https://getcomposer.org ). Then you can start the migration.

Install new sources of Lizmap.

Récupérez l’archive de Lizmap en téléchargeant depuis la page release de Github.

Vous devez alors :

  • rename the lizmap-web-client/ directory to lizmap-web-client.bak/ for example

  • extract files from the archive and rename the lizmap-web-client-3.10.0 directory to lizmap-web-client/, so it replaces the previous installation.

mv lizmap-web-client lizmap-web-client.bak
zip -r lizmap-web-client-3.10.0.zip
mv lizmap-web-client-3.10.0 lizmap-web-client

Migration

Go into the lizmap-web-client/lizmap/install/ directory and execute migrate_from_previous_version.sh. You must give the path of the old lizmap directory.

cd lizmap-web-client/lizmap/install/
migrate_from_previous_version.sh ../../../lizmap-web-client.bak/lizmap/

It will copy all configuration files and additionnal modules from the old installation, and update these modules.

Démarrez l’installeur

You have to launch the installer, which will upgrade some stuff: database tables, data etc.. You should stay in the lizmap-web-client/lizmap/install/ directory.

sudo clean_vartmp.sh
php configurator.php
php installer.php

Nettoyez et testez

Vous devez alors supprimer tous les fichiers de caches et temporaires.

sudo clean_vartmp.sh

Ensuite vous devez appeler le script qui applique des droits sur les fichiers. Les paramètres sont les noms de l’utilisateur et du groupe utilisé par le serveur web pour exécuter Lizmap. Su un serveur Debian, il s’agit en général de www-data.

sudo set_rights.sh www-data www-data

Ensuite chargez Lizmap dans votre navigateur, vous devriez voir vos cartes sans erreurs.

Revert upgrade

If the new installation does not work, you can restore the old installation, by simply rename the

lizmap-web-client.bak/ to lizmap-web-client/

mv lizmap-web-client lizmap-web-client.newbug
mv lizmap-web-client.bak lizmap-web-client

Migration de Sqlite vers Postgresql

Vous pourriez avoir installé Lizmap avec Sqlite. Vous devriez alors avoir ces fichiers lizmap/var/db/jauth.db et lizmap/var/db/logs.db, où sont stockés des données comme les utilisateurs, les permissions, les journaux. Et vous devriez avoir cette configuration dans lizmap/var/config/profiles.ini.php :

[jdb:jauth]
driver=sqlite3
database="var:db/jauth.db"

[jdb:lizlog]
driver=sqlite3
database="var:db/logs.db"

Si vous avez une telle configuration, vous pouvez migrer les données vers une base Postgresql.

Tout d’abord, créez une base de données Postgresql, et ensuite changez la configuration dans lizmap/var/config/profiles.ini.php, en mettant les paramètres d’accès à la base Postgresql. Il est recommandé de créer un schéma dans la base, par exemple « lizmap », si elle contient déjà des tables.

Voici un exemple :

[jdb:jauth]
driver=pgsql
host=localhost
port=5432
database="your_database"
user=my_login
password=my_password
search_path=lizmap,public

[jdb:lizlog]
driver=pgsql
host=localhost
port=5432
database="your_database"
user=my_login
password=my_password
search_path=lizmap,public

Voir le chapitre sur l’installation pour en savoir plus sur ces paramètres.

Puis vous pouvez lancer ces scripts qui migrerons les données.

php lizmap/console.php database:migrateusers
php lizmap/console.php database:migratelog

Si il n’y a pas d’erreurs, vous pouvez aller dans Lizmap avec votre navigateur, et vérifier que vous pouvez vous authentifier. Vous devriez voir également la liste des utilisateurs dans le panneau d’administration. Si c’est le cas, vous pouvez sauvegarder les fichier jauth.db et logs.db et les supprimer.

Si quelque chose ne va pas et que vous ne pouvez corriger le problème, remettez les accès à la base dans lizmap/var/config/profiles.ini.php  comme avant, comme ceci :

[jdb:jauth]
driver=sqlite3
database="var:db/jauth.db"

[jdb:lizlog]
driver=sqlite3
database="var:db/logs.db"

Et Lizmap devrait de nouveau fonctionner, mais toujours avec Sqlite.