diff --git a/scripts/backup b/scripts/backup index 86dca3b..0f46bc7 100644 --- a/scripts/backup +++ b/scripts/backup @@ -21,15 +21,11 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$install_dir" #================================================= -# BACKUP THE NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= 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" #================================================= diff --git a/scripts/install b/scripts/install index 4e1855d..8afbae5 100644 --- a/scripts/install +++ b/scripts/install @@ -66,8 +66,9 @@ ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name #================================================= ynh_script_progression --message="Configuring $app..." -ynh_add_config --template="../conf/config.inc.php" --destination="$install_dir/config.inc.php" -# config.inc.php contains sensitive data, restrict its access +ynh_add_config --template="config.inc.php" --destination="$install_dir/config.inc.php" + + chown $app: $install_dir/config.inc.php chmod 640 $install_dir/config.inc.php diff --git a/scripts/restore b/scripts/restore index 803e922..e026a02 100644 --- a/scripts/restore +++ b/scripts/restore @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # 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" diff --git a/scripts/upgrade b/scripts/upgrade index 3ca8379..0c7174e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,12 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -49,14 +43,10 @@ fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=5 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - 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 +# 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 chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" @@ -78,26 +68,22 @@ ynh_add_fpm_config #================================================= # UPGRADE THE DATABASE #================================================= +ynh_script_progression --message="Upgrading database..." --weight=2 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading database..." --weight=2 +# 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 - # 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 +# 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_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" \ + < $install_dir/sql/upgrade_tables_4_7_0+.sql - # 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_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" \ - < $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_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" \ - < $install_dir/sql/create_tables.sql -fi +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" \ + < $install_dir/sql/create_tables.sql #================================================= # GENERIC FINALIZATION