mirror of
https://github.com/YunoHost-Apps/agendav_ynh.git
synced 2024-09-03 20:36:12 +02:00
Merge 864d1a095e
into cccf9ef90e
This commit is contained in:
commit
3862889702
12 changed files with 77 additions and 202 deletions
BIN
.DS_Store
vendored
BIN
.DS_Store
vendored
Binary file not shown.
|
@ -1,4 +0,0 @@
|
||||||
; Additional php.ini defines, specific to this pool of workers.
|
|
||||||
|
|
||||||
php_admin_value[upload_max_filesize] = 50M
|
|
||||||
php_admin_value[post_max_size] = 50M
|
|
|
@ -12,7 +12,7 @@ location __PATH__/ {
|
||||||
try_files $uri __PATH__/__PATH__/index.php$is_args$args;
|
try_files $uri __PATH__/__PATH__/index.php$is_args$args;
|
||||||
location ~ ^__PATH__/index\.php(/|$) {
|
location ~ ^__PATH__/index\.php(/|$) {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;
|
||||||
|
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
|
|
|
@ -18,7 +18,8 @@ demo = "https://demo.yunohost.org/agendav"
|
||||||
admindoc = "https://agendav.readthedocs.io"
|
admindoc = "https://agendav.readthedocs.io"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2"
|
yunohost = ">= 11.2.18"
|
||||||
|
helpers_version = "2.1"
|
||||||
architectures = "all"
|
architectures = "all"
|
||||||
multi_instance = false
|
multi_instance = false
|
||||||
ldap = true
|
ldap = true
|
||||||
|
@ -55,6 +56,7 @@ ram.runtime = "10M"
|
||||||
[resources.system_user]
|
[resources.system_user]
|
||||||
|
|
||||||
[resources.install_dir]
|
[resources.install_dir]
|
||||||
|
group = "www-data:r-x"
|
||||||
|
|
||||||
[resources.permissions]
|
[resources.permissions]
|
||||||
main.url = "/"
|
main.url = "/"
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PERSONAL HELPERS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
_ynh_agendav_find_caldav_app() {
|
_ynh_agendav_find_caldav_app() {
|
||||||
|
@ -21,16 +17,8 @@ _ynh_agendav_find_caldav_app() {
|
||||||
caldav_app="${installed_baikal[0]}"
|
caldav_app="${installed_baikal[0]}"
|
||||||
caldav_baseurl=/
|
caldav_baseurl=/
|
||||||
else
|
else
|
||||||
ynh_die --message="Please install Baïkal or Radicale before AgenDAV."
|
ynh_die "Please install Baïkal or Radicale before AgenDAV."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "$caldav_app $caldav_baseurl"
|
echo -e "$caldav_app $caldav_baseurl"
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# EXPERIMENTAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FUTURE OFFICIAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
|
@ -1,59 +1,50 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
ynh_print_info "Declaring files to be backed up..."
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Clean cache files before backup
|
# Clean cache files before backup
|
||||||
ynh_secure_remove --file="$install_dir/web/var/cache/profiler"
|
ynh_safe_rm "$install_dir/web/var/cache/profiler"
|
||||||
ynh_secure_remove --file="$install_dir/web/var/cache/twig"
|
ynh_safe_rm "$install_dir/web/var/cache/twig"
|
||||||
mkdir -p "$install_dir/web/var/cache/"{profiler,twig}
|
mkdir -p "$install_dir/web/var/cache/"{profiler,twig}
|
||||||
chown -R "$app" "$install_dir/web/var/cache/"{profiler,twig}
|
chown -R "$app" "$install_dir/web/var/cache/"{profiler,twig}
|
||||||
|
|
||||||
ynh_backup --src_path="$install_dir"
|
ynh_backup "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
# BACKUP THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP LOGROTATE
|
# BACKUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
ynh_backup "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MYSQL DATABASE
|
# BACKUP THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Backing up the MySQL database..."
|
ynh_print_info "Backing up the MySQL database..."
|
||||||
|
|
||||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
ynh_mysql_dump_db > db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -1,25 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC STARTING
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
ynh_script_progression "Updating NGINX web server configuration..."
|
||||||
|
|
||||||
ynh_change_url_nginx_config
|
ynh_config_change_url_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
ynh_script_progression "Change of URL completed for $app"
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -17,47 +11,44 @@ caldav_info=$(_ynh_agendav_find_caldav_app)
|
||||||
caldav_app="$(cut -d " " -f 1 <<< "$caldav_info")"
|
caldav_app="$(cut -d " " -f 1 <<< "$caldav_info")"
|
||||||
caldav_baseurl="$(cut -d " " -f 2 <<< "$caldav_info")"
|
caldav_baseurl="$(cut -d " " -f 2 <<< "$caldav_info")"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=4
|
ynh_script_progression "Setting up source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||||
chown -R "$app:www-data" "$install_dir"
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
ynh_script_progression "Adding system configurations related to $app..."
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config
|
ynh_config_add_phpfpm
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
|
|
||||||
mkdir -p "/var/log/$app"
|
mkdir -p "/var/log/$app"
|
||||||
chown -R "$app:" "/var/log/$app"
|
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:" "/var/log/$app"
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_config_add_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=2
|
ynh_script_progression "Adding $app's configuration..."
|
||||||
|
|
||||||
# Generate random encryption key
|
# Generate random encryption key
|
||||||
encryptkey=$(ynh_string_random --length=24)
|
encryptkey=$(ynh_string_random --length=24)
|
||||||
|
|
||||||
ynh_app_setting_set --app="$app" --key=encryptkey --value="$encryptkey"
|
ynh_app_setting_set --key=encryptkey --value="$encryptkey"
|
||||||
|
|
||||||
# Copy and set AgenDAV configuration
|
# Copy and set AgenDAV configuration
|
||||||
timezone=$(cat /etc/timezone)
|
timezone=$(cat /etc/timezone)
|
||||||
|
@ -67,20 +58,19 @@ caldav_path=$(ynh_app_setting_get --app=$caldav_app --key=path)
|
||||||
caldav_url="https://${caldav_domain}${caldav_path%/}"
|
caldav_url="https://${caldav_domain}${caldav_path%/}"
|
||||||
caldav_baseurl="${caldav_url}${caldav_baseurl}"
|
caldav_baseurl="${caldav_url}${caldav_baseurl}"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/settings.php" --destination="${install_dir}/web/config/settings.php"
|
ynh_config_add --template="settings.php" --destination="${install_dir}/web/config/settings.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RUN DATABASE MIGRATIONS (INCLUDES INITIALIZATION)
|
# RUN DATABASE MIGRATIONS (INCLUDES INITIALIZATION)
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Initialising $app..." --weight=3
|
ynh_script_progression "Initialising $app..."
|
||||||
|
|
||||||
(
|
(
|
||||||
cd "$install_dir" || ynh_die
|
cd "$install_dir" || ynh_die
|
||||||
"php$phpversion" agendavcli migrations:migrate --no-interaction
|
"php$php_version" agendavcli migrations:migrate --no-interaction
|
||||||
)
|
)
|
||||||
|
|
||||||
chown -R "$app:www-data" "$install_dir"
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
# Only agendav user should write here
|
# Only agendav user should write here
|
||||||
chown -R "$app" "$install_dir/web/var/cache/"{profiler,twig}
|
chown -R "$app" "$install_dir/web/var/cache/"{profiler,twig}
|
||||||
|
|
||||||
|
@ -93,4 +83,4 @@ chmod -R 750 "$install_dir/web/config/"
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --last
|
ynh_script_progression "Installation of $app completed"
|
||||||
|
|
|
@ -1,34 +1,29 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SYSTEM CONFIGURATIONS
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SYSTEMD SERVICE
|
# REMOVE SYSTEMD SERVICE
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
ynh_script_progression "Removing system configurations related to $app..."
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_config_remove_logrotate
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_config_remove_nginx
|
||||||
|
|
||||||
# Remove the dedicated PHP-FPM config
|
# Remove the dedicated PHP-FPM config
|
||||||
ynh_remove_fpm_config
|
ynh_config_remove_phpfpm
|
||||||
|
|
||||||
ynh_secure_remove --file="/var/log/$app"
|
#REMOVEME? (Apps should not remove their log dir during remove ... this should only happen if --purge is used, and be handled by the core...) ynh_safe_rm "/var/log/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed" --last
|
ynh_script_progression "Removal of $app completed"
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
@ -13,16 +7,14 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
ynh_script_progression "Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$install_dir"
|
ynh_restore "$install_dir"
|
||||||
|
|
||||||
chmod 750 "$install_dir"
|
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R "$app:www-data" "$install_dir"
|
|
||||||
|
|
||||||
chown -R "$app:www-data" "$install_dir"
|
|
||||||
|
|
||||||
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
|
||||||
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||||
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir"
|
||||||
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir"
|
||||||
# Only agendav user should write here
|
# Only agendav user should write here
|
||||||
chown -R "$app" "$install_dir/web/var/cache/"{profiler,twig}
|
chown -R "$app" "$install_dir/web/var/cache/"{profiler,twig}
|
||||||
|
|
||||||
|
@ -34,38 +26,36 @@ chmod -R 750 "$install_dir/web/config/"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=2
|
ynh_script_progression "Restoring the MySQL database..."
|
||||||
|
|
||||||
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
|
ynh_mysql_db_shell < ./db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEM CONFIGURATIONS
|
# RESTORE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
ynh_script_progression "Restoring system configurations related to $app..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
mkdir -p "/var/log/$app"
|
mkdir -p "/var/log/$app"
|
||||||
chown -R "$app:" "/var/log/$app"
|
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:" "/var/log/$app"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=2
|
ynh_script_progression "Reloading NGINX web server and PHP-FPM..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
|
ynh_systemctl --service="php$php_version-fpm" --action=reload
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemctl --service=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app" --last
|
ynh_script_progression "Restoration completed for $app"
|
||||||
|
|
|
@ -1,20 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GET THE CALDAV APP
|
# GET THE CALDAV APP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -27,41 +15,39 @@ caldav_baseurl="$(cut -d " " -f 2 <<< "$caldav_info")"
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
|
||||||
|
if ynh_app_upstream_version_changed
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression "Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$install_dir" --keep="web/config/settings.php"
|
ynh_setup_source --dest_dir="$install_dir" --keep="web/config/settings.php"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 750 "$install_dir"
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
|
||||||
chmod -R o-rwx "$install_dir"
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||||
chown -R "$app:www-data" "$install_dir"
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REAPPLY SYSTEM CONFIGURATIONS
|
# REAPPLY SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
ynh_script_progression "Upgrading system configurations related to $app..."
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config
|
ynh_config_add_phpfpm
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
|
|
||||||
mkdir -p "/var/log/$app"
|
mkdir -p "/var/log/$app"
|
||||||
chown -R "$app:" "/var/log/$app"
|
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:" "/var/log/$app"
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate --non-append
|
ynh_config_add_logrotate
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC UPGRADE
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a configuration file..." --weight=2
|
ynh_script_progression "Updating configuration..."
|
||||||
|
|
||||||
# Copy and set AgenDAV configuration
|
# Copy and set AgenDAV configuration
|
||||||
timezone=$(cat /etc/timezone)
|
timezone=$(cat /etc/timezone)
|
||||||
|
@ -71,20 +57,19 @@ caldav_path=$(ynh_app_setting_get --app="$caldav_app" --key=path)
|
||||||
caldav_url="https://${caldav_domain}${caldav_path%/}"
|
caldav_url="https://${caldav_domain}${caldav_path%/}"
|
||||||
caldav_baseurl="${caldav_url}${caldav_baseurl}"
|
caldav_baseurl="${caldav_url}${caldav_baseurl}"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/settings.php" --destination="${install_dir}/web/config/settings.php"
|
ynh_config_add --template="settings.php" --destination="${install_dir}/web/config/settings.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RUN DATABASE MIGRATIONS (INCLUDES INITIALIZATION)
|
# RUN DATABASE MIGRATIONS (INCLUDES INITIALIZATION)
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading $app..." --weight=1
|
ynh_script_progression "Upgrading $app..."
|
||||||
|
|
||||||
(
|
(
|
||||||
cd "$install_dir" || ynh_die
|
cd "$install_dir" || ynh_die
|
||||||
"php$phpversion" agendavcli migrations:migrate --no-interaction
|
"php$php_version" agendavcli migrations:migrate --no-interaction
|
||||||
)
|
)
|
||||||
|
|
||||||
chown -R "$app:www-data" "$install_dir"
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
# Only agendav user should write here
|
# Only agendav user should write here
|
||||||
chown -R "$app" "$install_dir/web/var/cache/"{profiler,twig}
|
chown -R "$app" "$install_dir/web/var/cache/"{profiler,twig}
|
||||||
|
|
||||||
|
@ -94,10 +79,9 @@ chown -R "$app:www-data" "$install_dir/web/config/"
|
||||||
chmod -R 750 "$install_dir/web/config/"
|
chmod -R 750 "$install_dir/web/config/"
|
||||||
|
|
||||||
# FIXME: Should cleanup all the chmods.
|
# FIXME: Should cleanup all the chmods.
|
||||||
chmod 750 "$install_dir"
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
ynh_script_progression "Upgrade of $app completed"
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
--- a/web/app/controllers.php
|
|
||||||
+++ b/web/app/controllers.php
|
|
||||||
@@ -58,14 +58,20 @@ $controllers->before(function(Request $request, Silex\Application $app) {
|
|
||||||
// processing the request
|
|
||||||
if ($app['session']->has('username')) {
|
|
||||||
$username = $app['session']->get('username');
|
|
||||||
- $preferences = $app['preferences.repository']->userPreferences($username);
|
|
||||||
- $app['user.preferences'] = $preferences;
|
|
||||||
- $app['user.timezone'] = $preferences->get('timezone');
|
|
||||||
-
|
|
||||||
- // Set application language
|
|
||||||
- $request->setLocale($preferences->get('language'));
|
|
||||||
- $app['translator']->setLocale($preferences->get('language'));
|
|
||||||
- return;
|
|
||||||
+ // Clear user session if HTTP authentication changed
|
|
||||||
+ if (isset($_SERVER['PHP_AUTH_USER'])
|
|
||||||
+ && $username != $_SERVER['PHP_AUTH_USER']) {
|
|
||||||
+ $app['session']->clear();
|
|
||||||
+ } else {
|
|
||||||
+ $preferences = $app['preferences.repository']->userPreferences($username);
|
|
||||||
+ $app['user.preferences'] = $preferences;
|
|
||||||
+ $app['user.timezone'] = $preferences->get('timezone');
|
|
||||||
+
|
|
||||||
+ // Set application language
|
|
||||||
+ $request->setLocale($preferences->get('language'));
|
|
||||||
+ $app['translator']->setLocale($preferences->get('language'));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($request->isXmlHttpRequest()) {
|
|
||||||
diff --git a/web/src/Controller/Authentication.php b/web/src/Controller/Authentication.php
|
|
||||||
index deebb751..134cc9a8 100644
|
|
||||||
--- a/web/src/Controller/Authentication.php
|
|
||||||
+++ b/web/src/Controller/Authentication.php
|
|
||||||
@@ -34,9 +34,14 @@ class Authentication
|
|
||||||
$success = false;
|
|
||||||
$template_vars = [];
|
|
||||||
|
|
||||||
- if ($request->isMethod('POST')) {
|
|
||||||
- $user = $request->request->get('user');
|
|
||||||
- $password = $request->request->get('password');
|
|
||||||
+ if ($request->isMethod('POST') || isset($_SERVER['PHP_AUTH_USER'])) {
|
|
||||||
+ if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
|
|
||||||
+ $user = $_SERVER['PHP_AUTH_USER'];
|
|
||||||
+ $password = $_SERVER['PHP_AUTH_PW'];
|
|
||||||
+ } else {
|
|
||||||
+ $user = $request->request->get('user');
|
|
||||||
+ $password = $request->request->get('password');
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (empty($user) || empty($password)) {
|
|
||||||
$template_vars['error'] = $app['translator']->trans('messages.error_empty_fields');
|
|
Loading…
Add table
Reference in a new issue