From b2abcd9cefa16e5c5e0e6963a92ebc961be12d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 20 Jul 2021 08:30:59 +0200 Subject: [PATCH] Testing (#49) * 3.11.1 --- conf/app.src | 4 ++-- conf/php-fpm.conf | 3 ++- scripts/backup | 2 +- scripts/install | 20 ++++++++++++-------- scripts/remove | 5 +---- scripts/restore | 28 ++++++++++++++++++---------- scripts/upgrade | 4 +++- 7 files changed, 39 insertions(+), 27 deletions(-) diff --git a/conf/app.src b/conf/app.src index eb56b1d..75751b0 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/moodle/moodle/archive/v3.11.0.zip -SOURCE_SUM=03f878da9f4aeb10c0222d5f9addce7f6c64b216881221bcbac2fec8e34bde5a +SOURCE_URL=https://github.com/moodle/moodle/archive/v3.11.1.zip +SOURCE_SUM=571f1a59ae6af515932618ba757e98aeae7b9d2c5b10931f9b5296b24b222dfe SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 77b381e..84db00f 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -421,10 +421,11 @@ chdir = __FINALPATH__ ; Common values to change to increase file upload limit php_admin_value[upload_max_filesize] = 1G php_admin_value[post_max_size] = 1G +php_value[max_input_vars] = 1G ; php_admin_flag[mail.add_x_header] = Off ; Other common parameters ; php_admin_value[max_execution_time] = 600 ; php_admin_value[max_input_time] = 300 ; php_admin_value[memory_limit] = 256M -; php_admin_flag[short_open_tag] = On \ No newline at end of file +; php_admin_flag[short_open_tag] = On diff --git a/scripts/backup b/scripts/backup index 09f8c44..6229a5b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -73,4 +73,4 @@ ynh_psql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for Moodle. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 325ba44..1da150a 100644 --- a/scripts/install +++ b/scripts/install @@ -36,8 +36,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" -data_path=/home/yunohost.app/$app -test ! -e "$data_path" || ynh_die --message="This path already contains a folder" # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url @@ -50,7 +48,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=data_path --value=$data_path #================================================= # STANDARD MODIFICATIONS @@ -114,13 +111,18 @@ ynh_add_fpm_config --package="$extra_php_dependencies" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= -# SPECIFIC SETUP -#================================================= -# SECURE FILES AND DIRECTORIES +# CREATE DATA DIRECTORY #================================================= +ynh_script_progression --message="Creating a data directory..." --weight=1 + +data_path=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=data_path --value=$data_path mkdir -p $data_path -chown -R $app:www-data $data_path + +chmod 750 "$data_path" +chmod -R o-rwx "$data_path" +chown -R $app:www-data "$data_path" #================================================= # SETUP APPLICATION @@ -158,6 +160,8 @@ ynh_exec_as $app php$phpversion "$final_path/admin/cli/purge_caches.php" ynh_script_progression --message="Adding cron job..." --weight=2 ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" #================================================= # SETUP SSOWAT @@ -181,4 +185,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of Moodle completed" --last +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index 81e2e53..2c7cc30 100644 --- a/scripts/remove +++ b/scripts/remove @@ -74,9 +74,6 @@ ynh_script_progression --message="Removing various files..." --weight=2 # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" -# Remove a directory securely -ynh_secure_remove --file="$data_path" - #================================================= # GENERIC FINALIZATION #================================================= @@ -91,4 +88,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of Moodle completed" --last +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index bdb931e..9d1d15d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -36,12 +36,10 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -ynh_webpath_available --domain="$domain" --path_url="$path_url" \ +ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" -test ! -d "$final_path" \ +test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " -test ! -d "$data_path" \ - || ynh_die --message="There is already a directory: $data_path " #================================================= # STANDARD RESTORATION STEPS @@ -63,17 +61,27 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring Moodle main directory..." --weight=1 +ynh_script_progression --message="Restoring the app main directory..." --weight=1 -ynh_restore_file --origin_path=$final_path - -ynh_restore_file --origin_path=$data_path --not_mandatory +ynh_restore_file --origin_path="$final_path" # Restore permissions on app files chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -chown -R $app:www-data $data_path + +#================================================= +# RESTORE THE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Restoring the data directory..." --weight=1 + +ynh_restore_file --origin_path="$data_path" --not_mandatory + +mkdir -p $data_path + +chmod 750 "$data_path" +chmod -R o-rwx "$data_path" +chown -R $app:www-data "$data_path" #================================================= # RESTORE THE PHP-FPM CONFIGURATION @@ -127,4 +135,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for Moodle" --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index a47efdc..8526cc8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -163,6 +163,8 @@ ynh_exec_as $app php${phpversion} "$final_path/admin/cli/purge_caches.php" ynh_script_progression --message="Adding cron job..." --weight=4 ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" chown -R $app:www-data "$final_path" @@ -177,4 +179,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of Moodle completed" --last +ynh_script_progression --message="Upgrade of $app completed" --last