From 0b18cd6474742d96ab075e89bf3e56575d0a0ace Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Wed, 11 Apr 2018 21:02:30 +0200 Subject: [PATCH 1/6] Add upgrade from a previous commit --- check_process | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/check_process b/check_process index 8ac07eb..937a7cb 100644 --- a/check_process +++ b/check_process @@ -11,6 +11,7 @@ setup_private=0 setup_public=0 upgrade=1 + upgrade=1 from_commit=09ad01673cdfb9f893c138d92fce3bc965f5f8ed backup_restore=1 multi_instance=0 incorrect_path=1 @@ -31,3 +32,7 @@ ;;; Options Email= Notification=none +;;; Upgrade options + ; commit=09ad01673cdfb9f893c138d92fce3bc965f5f8ed + name=Force php5 for composer + manifest_arg=domain=DOMAIN&path=PATH&admin=USER& From b6434dd74e3216d0ec5b15539ea4bb42ef8b517c Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Wed, 23 May 2018 19:09:15 +0200 Subject: [PATCH 2/6] Fix stretch compatibility by creating and using a dedicated MySQL admin user (fixes #71) MySQL root access in Stretch is limited to socket access via the root system user (see here: https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost/42742610#42742610) In order to be compatible with Stretch and Jessie, use another privileged account than root --- conf/config.inc.php | 4 ++-- scripts/backup | 7 +++++++ scripts/install | 13 +++++++++++++ scripts/remove | 4 ++++ scripts/restore | 16 ++++++++++++++++ scripts/upgrade | 19 +++++++++++++++++++ 6 files changed, 61 insertions(+), 2 deletions(-) diff --git a/conf/config.inc.php b/conf/config.inc.php index 504ddf4..1ac8df4 100644 --- a/conf/config.inc.php +++ b/conf/config.inc.php @@ -28,8 +28,8 @@ $i = 0; $i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'config'; -$cfg['Servers'][$i]['user'] = 'root'; -$cfg['Servers'][$i]['password'] = 'YNH_MYSQL_ROOT_PASSWORD'; +$cfg['Servers'][$i]['user'] = 'YNH_PMA_ADMIN_USER'; +$cfg['Servers'][$i]['password'] = 'YNH_PMA_ADMIN_PASSWORD'; /* Server parameters */ /* $cfg['Servers'][$i]['host'] = 'localhost'; diff --git a/scripts/backup b/scripts/backup index 9bdb6f7..da545a5 100644 --- a/scripts/backup +++ b/scripts/backup @@ -21,6 +21,13 @@ set -eu # source _common.sh source /usr/share/yunohost/helpers +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # LOAD SETTINGS #================================================= diff --git a/scripts/install b/scripts/install index 9fda0c2..cab964f 100644 --- a/scripts/install +++ b/scripts/install @@ -59,6 +59,17 @@ db_name=$(ynh_sanitize_dbid $app) ynh_app_setting_set $app db_name $db_name ynh_mysql_setup_db $db_name $db_name +# Setup a privileged user for phpmyadmin (to prevent using MySQL root user) +db_admin_user="${app}_root" +ynh_app_setting_set $app db_admin_user $db_admin_user +db_admin_pwd="$(ynh_string_random)" +ynh_app_setting_set $app db_admin_pwd $db_admin_pwd + +if ! ynh_mysql_user_exists "$db_admin_user" ; then + ynh_mysql_create_user "$db_admin_user" "$db_admin_pwd" + ynh_mysql_execute_as_root "GRANT ALL PRIVILEGES ON *.* TO '$db_admin_user'@'localhost' IDENTIFIED BY '$db_admin_pwd' WITH GRANT OPTION; + FLUSH PRIVILEGES;" mysql +fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -106,6 +117,8 @@ ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" \ #================================================= ynh_replace_string "YNH_DOMAIN" "$domain" ../conf/config.inc.php +ynh_replace_string "YNH_PMA_ADMIN_USER" "$db_admin_user" ../conf/config.inc.php +ynh_replace_string "YNH_PMA_ADMIN_PASSWORD" "$db_admin_pwd" ../conf/config.inc.php ynh_replace_string "YNH_PMA_USER" "$db_name" ../conf/config.inc.php ynh_replace_string "YNH_PMA_PASSWORD" "$db_pwd" ../conf/config.inc.php ynh_replace_string "YNH_MYSQL_ROOT_PASSWORD" "$(cat $MYSQL_ROOT_PWD_FILE)" ../conf/config.inc.php diff --git a/scripts/remove b/scripts/remove index 73d2504..a7133c0 100644 --- a/scripts/remove +++ b/scripts/remove @@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) db_name=$(ynh_app_setting_get $app db_name) final_path=$(ynh_app_setting_get $app final_path) +db_admin_user=$(ynh_app_setting_get $app db_admin_user) #================================================= # STANDARD REMOVE @@ -28,6 +29,9 @@ final_path=$(ynh_app_setting_get $app final_path) # Remove a database if it exists, along with the associated user ynh_mysql_remove_db $db_name $db_name +# Remove phpmyadmin MySQL admin user +ynh_mysql_drop_user $db_admin_user + #================================================= # REMOVE APP MAIN DIR #================================================= diff --git a/scripts/restore b/scripts/restore index 611e363..26b8c71 100644 --- a/scripts/restore +++ b/scripts/restore @@ -21,6 +21,13 @@ set -eu # source _common.sh source /usr/share/yunohost/helpers +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # LOAD SETTINGS #================================================= @@ -64,6 +71,15 @@ db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_mysql_setup_db $db_name $db_name $db_pwd ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql +# Setup a privileged user for phpmyadmin (to prevent using MySQL root user) +db_admin_user=$(ynh_app_setting_get $app db_admin_user) +db_admin_pwd=$(ynh_app_setting_get $app db_admin_pwd) + +if ! ynh_mysql_user_exists "$db_admin_user" ; then + ynh_mysql_create_user "$db_admin_user" "$db_admin_pwd" + ynh_mysql_execute_as_root "GRANT ALL PRIVILEGES ON *.* TO '$db_admin_user'@'localhost' IDENTIFIED BY '$db_admin_pwd' WITH GRANT OPTION; + FLUSH PRIVILEGES;" mysql +fi #================================================= # RECREATE THE DEDICATED USER #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 3bd8553..acf0919 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,6 +20,8 @@ path_url=$(ynh_app_setting_get $app path) admin=$(ynh_app_setting_get $app admin) final_path=$(ynh_app_setting_get $app final_path) db_name=$(ynh_app_setting_get $app db_name) +db_admin_user=$(ynh_app_setting_get $app db_admin_user) +db_admin_pwd=$(ynh_app_setting_get $app db_admin_pwd) #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -45,6 +47,21 @@ if [ -z $admin ]; then ynh_app_setting_delete $app admin_user fi +# If db_admin_user doesn't exist, create it +if [ -z $db_admin_user ]; then + # Setup a privileged user for phpmyadmin (to prevent using MySQL root user) + db_admin_user="${app}_root" + ynh_app_setting_set $app db_admin_user $db_admin_user + db_admin_pwd="$(ynh_string_random)" + ynh_app_setting_set $app db_admin_pwd $db_admin_pwd + + if ! ynh_mysql_user_exists "$db_admin_user" ; then + ynh_mysql_create_user "$db_admin_user" "$db_admin_pwd" + ynh_mysql_execute_as_root "GRANT ALL PRIVILEGES ON *.* TO '$db_admin_user'@'localhost' IDENTIFIED BY '$db_admin_pwd' WITH GRANT OPTION; + FLUSH PRIVILEGES;" mysql + fi +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -122,6 +139,8 @@ ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" \ ynh_backup_if_checksum_is_different "$final_path/config.inc.php" ynh_replace_string "YNH_DOMAIN" "$domain" ../conf/config.inc.php +ynh_replace_string "YNH_PMA_ADMIN_USER" "$db_admin_user" ../conf/config.inc.php +ynh_replace_string "YNH_PMA_ADMIN_PASSWORD" "$db_admin_pwd" ../conf/config.inc.php ynh_replace_string "YNH_PMA_USER" "$db_name" ../conf/config.inc.php ynh_replace_string "YNH_PMA_PASSWORD" "$db_pwd" ../conf/config.inc.php ynh_replace_string "YNH_MYSQL_ROOT_PASSWORD" "$(cat $MYSQL_ROOT_PWD_FILE)" ../conf/config.inc.php From 3973cfe42318de5744d796995598ee1bd028e90e Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Wed, 23 May 2018 19:17:26 +0200 Subject: [PATCH 3/6] Update to upstream version 4.8.0.1 --- conf/app.src | 4 ++-- manifest.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/app.src b/conf/app.src index bee909a..3255e6e 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/phpmyadmin/phpmyadmin/archive/RELEASE_4_7_7.tar.gz -SOURCE_SUM=f8af08bb9e90c4c18b634626e6ab525d066d8e1a6fcf6a19cb0e14b29344adc8 +SOURCE_URL=https://github.com/phpmyadmin/phpmyadmin/archive/RELEASE_4_8_0_1.tar.gz +SOURCE_SUM=0014d662093e032916286bbd90bf587d112a3b13d6cb7d52b31b567c34474c01 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 29fcb4e..e815c5d 100644 --- a/manifest.json +++ b/manifest.json @@ -6,9 +6,9 @@ "en": "Manage MySQL databases over the web", "fr": "Application web de gestion des bases de données MySQL" }, - "version": "4.7.7", + "version": "4.8.0.1~ynh1", "url": "http://www.phpmyadmin.net", - "license": "GPL-2", + "license": "GPL-2.0-only", "maintainer": { "name": "julien", "email": "julien.malik@paraiso.me" From 1b277ad388c9c01181b23ef5376f0b39c3fce964 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Thu, 24 May 2018 20:31:58 +0200 Subject: [PATCH 4/6] Add phpMyAdmin temporary folder with needed rights (See here: https://stackoverflow.com/questions/49730100/error-in-phpmyadmin-after-updating-to-v4-8-0-the-cfgtempdir-tmp-is-no) --- scripts/install | 3 +++ scripts/upgrade | 3 +++ 2 files changed, 6 insertions(+) diff --git a/scripts/install b/scripts/install index 9fda0c2..e9aacbb 100644 --- a/scripts/install +++ b/scripts/install @@ -135,6 +135,9 @@ chown -R root: $final_path # config.inc.php contains sensitive data, restrict its access chown root:$app $final_path/config.inc.php chmod 640 $final_path/config.inc.php +# Setup phpMyAdmin temporary folder +mkdir $final_path/tmp +chown $app: $final_path/tmp #================================================= # SETUP SSOWAT diff --git a/scripts/upgrade b/scripts/upgrade index 3bd8553..8eb660c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -151,6 +151,9 @@ chown -R root: $final_path # config.inc.php contains sensitive data, restrict its access chown root:$app $final_path/config.inc.php chmod 640 $final_path/config.inc.php +# Setup phpMyAdmin temporary folder +mkdir $final_path/tmp +chown $app: $final_path/tmp #================================================= # SETUP SSOWAT From 6b9e9deaf3ddc786d81111895c6ce034e26dc0a6 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Thu, 24 May 2018 22:22:52 +0200 Subject: [PATCH 5/6] Avoid error if temporary directory already exists --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index e9aacbb..b99c3a3 100644 --- a/scripts/install +++ b/scripts/install @@ -136,7 +136,7 @@ chown -R root: $final_path chown root:$app $final_path/config.inc.php chmod 640 $final_path/config.inc.php # Setup phpMyAdmin temporary folder -mkdir $final_path/tmp +mkdir -p $final_path/tmp chown $app: $final_path/tmp #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 8eb660c..c02a29e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -152,7 +152,7 @@ chown -R root: $final_path chown root:$app $final_path/config.inc.php chmod 640 $final_path/config.inc.php # Setup phpMyAdmin temporary folder -mkdir $final_path/tmp +mkdir -p $final_path/tmp chown $app: $final_path/tmp #================================================= From 5a186d516244a4fe97496dd91e801a9fcdf8062e Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Mon, 28 May 2018 10:54:41 +0200 Subject: [PATCH 6/6] Create pull_request_template.md Duplicated from https://github.com/YunoHost-Apps/searx_ynh/pull/35, merged as a micro decision --- pull_request_template.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 pull_request_template.md diff --git a/pull_request_template.md b/pull_request_template.md new file mode 100644 index 0000000..a5b4871 --- /dev/null +++ b/pull_request_template.md @@ -0,0 +1,25 @@ +## Problem +- *Description of why you made this PR* + +## Solution +- *And how you fix that* + +## PR Status +- [ ] Code finished. +- [ ] Tested with Package_check. +- [ ] Fix or enhancement tested. +- [ ] Upgrade from last version tested. +- [ ] Can be reviewed and tested. + +## Validation +--- +*Minor decision* +- **Upgrade previous version** : +- [ ] **Code review** : +- [ ] **Approval (LGTM)** : +- [ ] **Approval (LGTM)** : +- **CI succeeded** : +[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/phpmyadmin_ynh%20-BRANCH-%20(Official)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/phpmyadmin_ynh%20-BRANCH-%20(Official)/) *Please replace '-BRANCH-' in this link for a PR from a local branch.* +or +[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/phpmyadmin_ynh%20PR-NUM-%20(Official_fork)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/phpmyadmin_ynh%20PR-NUM-%20(Official_fork)/) *Replace '-NUM-' by the PR number in this link for a PR from a forked repository.* +When the PR is marked as ready to merge, you have to wait for 3 days before really merging it.