1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/phpmyadmin_ynh.git synced 2024-09-03 19:56:46 +02:00
This commit is contained in:
Éric Gaspar 2024-06-02 15:08:35 +02:00
parent 1da5c8924d
commit 213d5d213c
4 changed files with 21 additions and 38 deletions

View file

@ -21,15 +21,11 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$install_dir" ynh_backup --src_path="$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#================================================= #=================================================

View file

@ -66,8 +66,9 @@ ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name
#================================================= #=================================================
ynh_script_progression --message="Configuring $app..." ynh_script_progression --message="Configuring $app..."
ynh_add_config --template="../conf/config.inc.php" --destination="$install_dir/config.inc.php" ynh_add_config --template="config.inc.php" --destination="$install_dir/config.inc.php"
# config.inc.php contains sensitive data, restrict its access
chown $app: $install_dir/config.inc.php chown $app: $install_dir/config.inc.php
chmod 640 $install_dir/config.inc.php chmod 640 $install_dir/config.inc.php

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring phpMyAdmin main directory..." --weight=1 ynh_script_progression --message="Restoring $app main directory..." --weight=1
ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="$install_dir"

View file

@ -9,12 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
@ -49,14 +43,10 @@ fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=5
if [ "$upgrade_type" == "UPGRADE_APP" ] # Download, check integrity, uncompress and patch the source from app.src
then ynh_setup_source --dest_dir="$install_dir" --keep="config.inc.php" --full_replace=1
ynh_script_progression --message="Upgrading source files..." --weight=5
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep="config.inc.php" --full_replace=1
fi
chmod 750 "$install_dir" chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
@ -78,26 +68,22 @@ ynh_add_fpm_config
#================================================= #=================================================
# UPGRADE THE DATABASE # UPGRADE THE DATABASE
#================================================= #=================================================
ynh_script_progression --message="Upgrading database..." --weight=2
if [ "$upgrade_type" == "UPGRADE_APP" ] # Handle upgrade from a version before latest version
then # Ignore warnings and failures that will occur if already on latest version
ynh_script_progression --message="Upgrading database..." --weight=2 ynh_replace_string --match_string="phpmyadmin" --replace_string="$db_name" --target_file=$install_dir/sql/upgrade_column_info_4_3_0+.sql
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" \
# Handle upgrade from a version before latest version
# Ignore warnings and failures that will occur if already on latest version
ynh_replace_string --match_string="phpmyadmin" --replace_string="$db_name" --target_file=$install_dir/sql/upgrade_column_info_4_3_0+.sql
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" \
< $install_dir/sql/upgrade_column_info_4_3_0+.sql > /dev/null 2>&1 || true < $install_dir/sql/upgrade_column_info_4_3_0+.sql > /dev/null 2>&1 || true
# Upgrade from last version (don't ignore failures) # Upgrade from last version (don't ignore failures)
ynh_replace_string --match_string="phpmyadmin" --replace_string="$db_name" --target_file=$install_dir/sql/upgrade_tables_4_7_0+.sql ynh_replace_string --match_string="phpmyadmin" --replace_string="$db_name" --target_file=$install_dir/sql/upgrade_tables_4_7_0+.sql
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" \ ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" \
< $install_dir/sql/upgrade_tables_4_7_0+.sql < $install_dir/sql/upgrade_tables_4_7_0+.sql
ynh_replace_string --match_string="phpmyadmin" --replace_string="$db_name" --target_file=$install_dir/sql/create_tables.sql ynh_replace_string --match_string="phpmyadmin" --replace_string="$db_name" --target_file=$install_dir/sql/create_tables.sql
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" \ ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" \
< $install_dir/sql/create_tables.sql < $install_dir/sql/create_tables.sql
fi
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION