1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/moodle_ynh.git synced 2024-09-03 19:46:23 +02:00

Merge branch 'testing' of https://github.com/YunoHost-Apps/moodle_ynh into testing

This commit is contained in:
ericgaspar 2021-06-29 19:09:00 +02:00
commit 85a40a1363
No known key found for this signature in database
GPG key ID: 574F281483054D44
5 changed files with 35 additions and 24 deletions

View file

@ -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)."

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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