1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/limesurvey_ynh.git synced 2024-09-03 19:36:32 +02:00
This commit is contained in:
ericgaspar 2021-07-12 14:06:32 +02:00
parent 4b6e78d4f7
commit 0581d78a71
5 changed files with 26 additions and 72 deletions

View file

@ -13,15 +13,6 @@ pkg_dependencies="php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-mysql php${YNH
#=================================================
# SPECIFIC HELPERS
#=================================================
set_permissions () {
find $final_path -type f -name "*.php" -print0 | xargs -0 chmod 400 \
|| echo "No file to modify"
#chown root: $final_path/application/config/config.php
chmod -R u+w $final_path/tmp
chmod -R u+w $final_path/upload
chmod -R u+w $final_path/application/config/
}
#=================================================
# COMMON HELPERS
@ -63,19 +54,15 @@ ynh_send_readme_to_admin() {
}
recipients=$(find_mails "$recipients")
local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!"
local mail_subject="☁️🆈🅽🅷☁️: \`$app\` has important message for you"
local mail_message="This is an automated message from your beloved YunoHost server.
Specific information for the application $app.
$app_message
---
Automatic diagnosis data from YunoHost
$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
# Define binary to use for mail command
if [ -e /usr/bin/bsd-mailx ]
then

View file

@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
@ -37,7 +37,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
@ -70,7 +70,7 @@ fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -99,7 +99,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
@ -107,4 +107,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --time --last
ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -88,9 +88,7 @@ ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod 755 "$final_path/tmp"
chmod 755 "$final_path/upload"
chmod 755 "$final_path/application/config/"
chmod 755 "$final_path/{tmp, upload, application/config"
#=================================================
# NGINX CONFIGURATION
@ -183,14 +181,15 @@ ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
ynh_script_progression --message="Sending some explanation to use $app..." --weight=1
ynh_script_progression --message="Sending a readme for the admin..." --weight=1
ynh_print_OFF
message="You can now create a poll on this address: https://${domain}${path_url}/admin/
If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/limesurvey_ynh"
message="LimeSurvey was successfully installed :)
ynh_send_readme_to_admin "$message" "$admin"
ynh_print_ON
You can now create a poll on this address: https://$domain$path_url/admin/
If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/limesurvey_ynh/issues"
ynh_send_readme_to_admin "$message"
#=================================================
# END OF SCRIPT

View file

@ -72,6 +72,7 @@ ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod 755 "$final_path/{tmp, upload, application/config"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
@ -109,14 +110,6 @@ ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --w
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
message="If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/leed_ynh"
ynh_send_readme_to_admin "$message" "$admin"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -51,26 +51,17 @@ ynh_abort_if_errors
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
#
# N.B. : the followings setting migrations snippets are provided as *EXAMPLES*
# of what you may want to do in some cases (e.g. a setting was not defined on
# some legacy installs and you therefore want to initiaze stuff during upgrade)
#
# If db_name doesn't exist, create it
#if [ -z "$db_name" ]; then
# db_name=$(ynh_sanitize_dbid --db_name=$app)
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
#fi
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If final_path doesn't exist, create it
#if [ -z "$final_path" ]; then
# final_path=/var/www/$app
# ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#fi
### If nobody installed your app before 4.1,
### then you may safely remove these lines
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
@ -114,6 +105,7 @@ fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod 755 "$final_path/{tmp, upload, application/config"
#=================================================
# NGINX CONFIGURATION
@ -138,29 +130,12 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
# SECURING FILES AND DIRECTORIES
#=================================================
#set_permissions
#=================================================
# UPGRADE DB
#=================================================
# Migrate DB
cd $final_path
ynh_exec_as "$app" php application/commands/console.php updatedb
#=================================================
# Send message to the admin
#=================================================
if ynh_version_le "2.62.2-2" ; then
message="LimeSurvey has been upgraded from version to version 3, note this new version change completely the survey themes system. If you have added or created manually some templates they won't be available in your LimeSurvey, a copy of their source code has been done in /home/yunohost.backup/$app-old-templates/. See https://manual.limesurvey.org/New_Template_System_in_LS3.x"
ynh_warn "$message"
ynh_send_readme_to_admin "$message" "$admin"
fi
ynh_exec_as "$app" php $final_path/application/commands/console.php updatedb
#=================================================
# RELOAD NGINX