From 63717d4b8235b1a8f9df826148bc8bfcc5263b61 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 25 Sep 2022 22:11:49 +0200 Subject: [PATCH] 5.2.0 --- conf/app.src | 4 +- conf/nginx.conf | 2 +- doc/{DISCLAIMER.md => DESCRIPTION.md} | 2 - doc/{DISCLAIMER_fr.md => DESCRIPTION_fr.md} | 2 - manifest.json | 2 +- scripts/_common.sh | 2 +- scripts/backup | 2 +- scripts/install | 21 +++++----- scripts/remove | 16 +++---- scripts/restore | 40 +++++++++--------- scripts/upgrade | 46 ++++++++++----------- 11 files changed, 67 insertions(+), 72 deletions(-) rename doc/{DISCLAIMER.md => DESCRIPTION.md} (92%) rename doc/{DISCLAIMER_fr.md => DESCRIPTION_fr.md} (85%) diff --git a/conf/app.src b/conf/app.src index 1f37267..279911f 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://files.phpmyadmin.net/phpMyAdmin/5.1.3/phpMyAdmin-5.1.3-all-languages.tar.gz -SOURCE_SUM=7a85454d82d88cc1a6beb09114a67fa40230c4eff2ae1778b434fa74e80dc6d7 +SOURCE_URL=https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-all-languages.tar.gz +SOURCE_SUM=f794528eebf1b723a29b89d239963e979a251fb484fd6e788919bf8cbca7db39 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/nginx.conf b/conf/nginx.conf index 3dee724..5918d1e 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/ ; + alias __FINALPATH__/; index index.php; diff --git a/doc/DISCLAIMER.md b/doc/DESCRIPTION.md similarity index 92% rename from doc/DISCLAIMER.md rename to doc/DESCRIPTION.md index e9f5ca8..10070ff 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DESCRIPTION.md @@ -1,3 +1 @@ -## Overview - phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web. phpMyAdmin supports a wide range of operations on MySQL and MariaDB. Frequently used operations (managing databases, tables, columns, relations, indexes, users, permissions, etc) can be performed via the user interface, while you still have the ability to directly execute any SQL statement. \ No newline at end of file diff --git a/doc/DISCLAIMER_fr.md b/doc/DESCRIPTION_fr.md similarity index 85% rename from doc/DISCLAIMER_fr.md rename to doc/DESCRIPTION_fr.md index 9d3bf51..513f4a8 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -1,3 +1 @@ -## Vue d'ensemble - phpMyAdmin est un outil logiciel libre écrit en PHP, destiné à gérer l'administration de MySQL sur le Web. phpMyAdmin prend en charge un large éventail d'opérations sur MySQL et MariaDB. Les opérations fréquemment utilisées (gestion des bases de données, des tables, des colonnes, des relations, des index, des utilisateurs, des autorisations, etc.) peuvent être effectuées via l'interface utilisateur, tandis que vous avez toujours la possibilité d'exécuter directement les instructions SQL. \ No newline at end of file diff --git a/manifest.json b/manifest.json index c231eab..0b548bd 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Manage MySQL databases over the web", "fr": "Application web de gestion des bases de données MySQL" }, - "version": "5.1.3~ynh1", + "version": "5.2.0~ynh1", "url": "http://www.phpmyadmin.net", "upstream": { "license": "GPL-2.0-only", diff --git a/scripts/_common.sh b/scripts/_common.sh index 2babaa3..4ed82a8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,7 +8,7 @@ YNH_PHP_VERSION="7.4" pkg_dependencies="php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-mbstring" -YNH_COMPOSER_VERSION=2.0.14 +YNH_COMPOSER_VERSION=2.4.2 #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 0a9e6c8..9d87ffa 100644 --- a/scripts/backup +++ b/scripts/backup @@ -48,7 +48,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/install b/scripts/install index e2d78d8..f5f51f3 100644 --- a/scripts/install +++ b/scripts/install @@ -63,7 +63,7 @@ ynh_script_progression --message="Creating a MySQL database..." db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name # Setup a privileged user for phpmyadmin (to prevent using MySQL root user) db_admin_user="${app}_root" @@ -99,14 +99,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=3 - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -115,6 +107,14 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 # Create a dedicated PHP-FPM config ynh_add_fpm_config +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring NGINX web server..." --weight=3 + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # SPECIFIC SETUP #================================================= @@ -132,7 +132,7 @@ ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name #================================================= # CONFIGURE PHPMYADMIN #================================================= -ynh_script_progression --message="Configuring phpMyAdmin..." +ynh_script_progression --message="Configuring phpMyAdmin..." --weight=2 ynh_add_config --template="../conf/config.inc.php" --destination="$final_path/config.inc.php" # config.inc.php contains sensitive data, restrict its access @@ -148,7 +148,6 @@ ynh_script_progression --message="Installing dependencies with Composer..." --we ynh_install_composer # Install dependencies -# ynh_exec_warn_less ynh_composer_exec --commands="update --no-dev" ynh_composer_exec --commands="update --no-dev" #================================================= diff --git a/scripts/remove b/scripts/remove index 2c3895a..19c5569 100644 --- a/scripts/remove +++ b/scripts/remove @@ -34,14 +34,6 @@ ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name # Remove phpmyadmin MySQL admin user ynh_mysql_drop_user $db_admin_user -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= @@ -66,6 +58,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration" --weight=2 # Remove the dedicated PHP-FPM config ynh_remove_fpm_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=1 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 32c669d..3362be7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -28,6 +28,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -39,12 +40,6 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -70,8 +65,8 @@ chown -R $app:www-data "$final_path" ynh_script_progression --message="Restoring the MySQL database..." --weight=4 db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd -ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql # Setup a privileged user for phpmyadmin (to prevent using MySQL root user) db_admin_user=$(ynh_app_setting_get --app=$app --key=db_admin_user) @@ -90,17 +85,6 @@ fi chown $app: $final_path/tmp -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Reconfiguring PHP-FPM.." --weight=6 - -# Restore the file first, so it can have a backup if different -ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" - -# Recreate a dedicated php-fpm config -ynh_add_fpm_config - #================================================= # REINSTALL DEPENDENCIES #================================================= @@ -109,13 +93,29 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Reconfiguring PHP-FPM.." --weight=6 + +# Restore the file first, so it can have a backup if different +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 +ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4a2288b..295ee28 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,6 +31,20 @@ db_admin_pwd=$(ynh_app_setting_get --app=$app --key=db_admin_pwd) upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up phpMyAdmin before upgrading (may take a while)..." --weight=15 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -77,24 +91,10 @@ if ! ynh_permission_exists --permission="admin"; then ynh_permission_create --permission="admin" --allowed=$admin fi -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up phpMyAdmin before upgrading (may take a while)..." --weight=15 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$final_path" @@ -117,14 +117,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=3 - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -140,6 +132,14 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=4 # Create a dedicated PHP-FPM config ynh_add_fpm_config +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=3 + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # SPECIFIC UPGRADE #=================================================