mirror of
https://github.com/YunoHost-Apps/flarum_ynh.git
synced 2024-09-03 18:36:24 +02:00
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
parent
fac7a60da3
commit
91a54d23cf
11 changed files with 160 additions and 214 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
*~
|
*~
|
||||||
*.sw[op]
|
*.sw[op]
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
php_admin_value[upload_max_filesize] = 100M
|
php_admin_value[upload_max_filesize] = 100M
|
||||||
php_admin_value[post_max_size] = 100M
|
|
||||||
env[COMPOSER_HOME] = __INSTALL_DIR__/.composer
|
env[COMPOSER_HOME] = __INSTALL_DIR__/.composer
|
||||||
|
|
|
@ -11,7 +11,7 @@ location __PATH__/ {
|
||||||
|
|
||||||
location ~* \.php$ {
|
location ~* \.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;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
fastcgi_param HTTP_PROXY ""; # Fix for https://httpoxy.org/ vulnerability
|
fastcgi_param HTTP_PROXY ""; # Fix for https://httpoxy.org/ vulnerability
|
||||||
|
|
|
@ -20,7 +20,8 @@ cpe = "cpe:2.3:a:flarum:flarum"
|
||||||
fund = "https://flarum.org/donate/"
|
fund = "https://flarum.org/donate/"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2"
|
yunohost = ">= 11.2.18"
|
||||||
|
helpers_version = "2.1"
|
||||||
architectures = "all"
|
architectures = "all"
|
||||||
multi_instance = true
|
multi_instance = true
|
||||||
ldap = true
|
ldap = true
|
||||||
|
@ -88,6 +89,7 @@ ram.runtime = "50M"
|
||||||
[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,27 +1,23 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
swap_needed=1024
|
swap_needed=1024
|
||||||
|
|
||||||
# PHP
|
# PHP
|
||||||
YNH_COMPOSER_VERSION="2.0.13"
|
composer_version="2.0.13"
|
||||||
|
|
||||||
# Version numbers
|
# Version numbers
|
||||||
project_version="1.8.0"
|
project_version="1.8.0"
|
||||||
#core_version is now retrieved from the manifest
|
#core_version is now retrieved from the manifest
|
||||||
ldap_version="*"
|
ldap_version="*"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PERSONAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Activate extension in Flarum's database
|
# Activate extension in Flarum's database
|
||||||
# usage: activate_flarum_extension $db_name $extension $short_extension
|
# usage: activate_flarum_extension $db_name $extension $short_extension
|
||||||
# $short_extension is the extension name written in database, how it is shortened is still a mystery
|
# $short_extension is the extension name written in database, how it is shortened is still a mystery
|
||||||
activate_flarum_extension() {
|
activate_flarum_extension() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=ds
|
#REMOVEME? local legacy_args=ds
|
||||||
declare -Ar args_array=( [d]=database= [s]=short_extension )
|
declare -Ar args_array=( [d]=database= [s]=short_extension )
|
||||||
local database
|
local database
|
||||||
local short_extension
|
local short_extension
|
||||||
|
@ -36,7 +32,7 @@ activate_flarum_extension() {
|
||||||
|
|
||||||
# Retrieve current extensions
|
# Retrieve current extensions
|
||||||
sql_command="SELECT \`value\` FROM settings WHERE \`key\` = 'extensions_enabled'"
|
sql_command="SELECT \`value\` FROM settings WHERE \`key\` = 'extensions_enabled'"
|
||||||
old_extensions_enabled=$(ynh_mysql_execute_as_root "$sql_command" $database | tail -1)
|
old_extensions_enabled=$(ynh_mysql_db_shell <<< "$sql_command" $database | tail -1)
|
||||||
|
|
||||||
# Use jq to test presence of the extension in the list of enabled extensions
|
# Use jq to test presence of the extension in the list of enabled extensions
|
||||||
# if not, then add it.
|
# if not, then add it.
|
||||||
|
@ -44,11 +40,7 @@ activate_flarum_extension() {
|
||||||
|
|
||||||
# Update activated extensions list
|
# Update activated extensions list
|
||||||
sql_command="UPDATE \`settings\` SET \`value\`='$new_extensions_enabled' WHERE \`key\`='extensions_enabled';"
|
sql_command="UPDATE \`settings\` SET \`value\`='$new_extensions_enabled' WHERE \`key\`='extensions_enabled';"
|
||||||
ynh_mysql_execute_as_root "$sql_command" $database
|
ynh_mysql_db_shell <<< "$sql_command" $database
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# EXPERIMENTAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# See ynh_* scripts
|
# See ynh_* scripts
|
||||||
|
|
|
@ -1,37 +1,28 @@
|
||||||
#!/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
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
|
@ -39,17 +30,17 @@ ynh_backup --src_path="/etc/php/$phpversion/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,11 +1,5 @@
|
||||||
#!/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
|
||||||
|
|
||||||
|
@ -24,27 +18,27 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
ynh_script_progression "Loading installation settings..."
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
# Needed for helper "ynh_config_add_nginx"
|
||||||
install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
install_dir=$(ynh_app_setting_get --key=install_dir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
ynh_script_progression "Backing up the app before changing its URL (may take a while)..."
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
#REMOVEME? ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
#REMOVEME? ynh_clean_setup () {
|
||||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_safe_rm "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
|
||||||
# Restore it if the upgrade fails
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
#REMOVEME? ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
|
@ -62,12 +56,10 @@ then
|
||||||
change_path=1
|
change_path=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
ynh_script_progression "Updating NGINX web server configuration..."
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
|
@ -75,22 +67,22 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
if [ $change_path -eq 1 ]
|
if [ $change_path -eq 1 ]
|
||||||
then
|
then
|
||||||
# Make a backup of the original NGINX config file if modified
|
# Make a backup of the original NGINX config file if modified
|
||||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
ynh_backup_if_checksum_is_different "$nginx_conf_path"
|
||||||
# Set global variables for NGINX helper
|
# Set global variables for NGINX helper
|
||||||
domain="$old_domain"
|
domain="$old_domain"
|
||||||
path_url="$new_path"
|
path_url="$new_path"
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change the domain for NGINX
|
# Change the domain for NGINX
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]
|
||||||
then
|
then
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
ynh_delete_file_checksum "$nginx_conf_path"
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||||
# Store file checksum for the new config file location
|
# Store file checksum for the new config file location
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -100,29 +92,31 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
if [ $new_path = "/" ]; then
|
if [ $new_path = "/" ]; then
|
||||||
if [ $old_path = "/" ]; then
|
if [ $old_path = "/" ]; then
|
||||||
ynh_replace_string "://$old_domain" "://$new_domain" "$install_dir/config.php"
|
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||||
|
ynh_replace "://$old_domain" "://$new_domain" "$install_dir/config.php"
|
||||||
else
|
else
|
||||||
ynh_replace_string "://$old_domain$old_path" "://$new_domain" "$install_dir/config.php"
|
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||||
|
ynh_replace "://$old_domain$old_path" "://$new_domain" "$install_dir/config.php"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ $old_path = "/" ]; then
|
if [ $old_path = "/" ]; then
|
||||||
ynh_replace_string "://$old_domain" "://$new_domain$new_path" "$install_dir/config.php"
|
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||||
|
ynh_replace "://$old_domain" "://$new_domain$new_path" "$install_dir/config.php"
|
||||||
else
|
else
|
||||||
ynh_replace_string "://$old_domain$old_path" "://$new_domain$new_path" "$install_dir/config.php"
|
# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file=
|
||||||
|
ynh_replace "://$old_domain$old_path" "://$new_domain$new_path" "$install_dir/config.php"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALISATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
ynh_script_progression "Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemctl --service=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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,15 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source experimental_helpers/ynh_add_swap
|
source experimental_helpers/ynh_add_swap
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
ynh_app_setting_set --key=php_upload_max_filesize --value=100M
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -21,117 +17,116 @@ admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_app_setting_set --app=$app --key=language --value="$language"
|
ynh_app_setting_set --key=language --value="$language"
|
||||||
ynh_app_setting_set --app=$app --key=project_version --value="$project_version"
|
ynh_app_setting_set --key=project_version --value="$project_version"
|
||||||
ynh_app_setting_set --app=$app --key=core_version --value="$core_version"
|
ynh_app_setting_set --key=core_version --value="$core_version"
|
||||||
ynh_app_setting_set --app=$app --key=ldap_version --value="$ldap_version"
|
ynh_app_setting_set --key=ldap_version --value="$ldap_version"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=3
|
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" --source_id="flarum"
|
ynh_setup_source --dest_dir="$install_dir" --source_id="flarum"
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
# 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 SWAP
|
# ADD SWAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Adding swap..."
|
ynh_print_info "Adding swap..."
|
||||||
|
|
||||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then
|
if ! ynh_in_ci_tests; then
|
||||||
ynh_add_swap --size=$swap_needed
|
ynh_add_swap --size=$swap_needed
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL COMPOSER DEPENDENCIES
|
# INSTALL COMPOSER DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing composer dependencies..." --weight=5
|
ynh_script_progression "Installing composer dependencies..."
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$install_dir"
|
ynh_composer_install
|
||||||
|
ynh_composer_exec install --no-dev
|
||||||
|
|
||||||
# Set Flarum version
|
# Set Flarum version
|
||||||
ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$install_dir --commands="require flarum/core:$core_version --prefer-lowest --no-update"
|
ynh_composer_exec require flarum/core:$core_version --prefer-lowest --no-update
|
||||||
|
|
||||||
# Require LDAP extension
|
# Require LDAP extension
|
||||||
ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$install_dir --commands="require tituspijean/flarum-ext-auth-ldap:$ldap_version --no-update"
|
ynh_composer_exec require tituspijean/flarum-ext-auth-ldap:$ldap_version --no-update
|
||||||
|
|
||||||
# Update and download dependencies
|
# Update and download dependencies
|
||||||
ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$install_dir --commands="update"
|
ynh_composer_exec update
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# FLARUM POST-INSTALL
|
# FLARUM POST-INSTALL
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring Flarum..." --weight=2
|
ynh_script_progression "Configuring Flarum..."
|
||||||
|
|
||||||
# Copy and populate configuration.yml to working directory
|
# Copy and populate configuration.yml to working directory
|
||||||
ynh_add_config --template="../conf/configuration.yml" --destination="$install_dir/configuration.yml"
|
ynh_config_add --template="configuration.yml" --destination="$install_dir/configuration.yml"
|
||||||
|
|
||||||
# Execute post-installation
|
# Execute post-installation
|
||||||
pushd $install_dir
|
pushd $install_dir
|
||||||
ynh_exec_as $app php$phpversion -d $install_dir -d memory_limit=-1 flarum install -f configuration.yml
|
ynh_exec_as_app php$php_version -d $install_dir -d memory_limit=-1 flarum install -f configuration.yml
|
||||||
# Delete configuration.yml as it contains sensitive data
|
# Delete configuration.yml as it contains sensitive data
|
||||||
ynh_secure_remove --file="$install_dir/configuration.yml"
|
ynh_safe_rm "$install_dir/configuration.yml"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# Email setup
|
# Email setup
|
||||||
ynh_add_config --template="../conf/mail.sql.template" --destination="../conf/mail.sql"
|
ynh_config_add --template="mail.sql.template" --destination="../conf/mail.sql"
|
||||||
ynh_mysql_connect_as --user=$app --password="$db_pwd" --database=$db_name < ../conf/mail.sql
|
ynh_mysql_db_shell < ../conf/mail.sql
|
||||||
|
|
||||||
# Enable and set up the LDAP auth extension
|
# Enable and set up the LDAP auth extension
|
||||||
ynh_script_progression --message="Enabling and configuring LDAP extension..." --weight=2
|
ynh_script_progression "Enabling and configuring LDAP extension..."
|
||||||
activate_flarum_extension $db_name "tituspijean-auth-ldap"
|
activate_flarum_extension $db_name "tituspijean-auth-ldap"
|
||||||
ynh_add_config --template="../conf/ldap.sql.template" --destination="../conf/ldap.sql"
|
ynh_config_add --template="ldap.sql.template" --destination="../conf/ldap.sql"
|
||||||
ynh_mysql_connect_as --user=$app --password="$db_pwd" --database=$db_name < ../conf/ldap.sql
|
ynh_mysql_db_shell < ../conf/ldap.sql
|
||||||
|
|
||||||
# Install, activate and set language extensions
|
# Install, activate and set language extensions
|
||||||
case $language in
|
case $language in
|
||||||
fr)
|
fr)
|
||||||
ynh_script_progression --message="Installing French extension..." --weight=2
|
ynh_script_progression "Installing French extension..."
|
||||||
ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$install_dir --commands="require qiaeru/lang-french:*"
|
ynh_composer_exec require qiaeru/lang-french:*
|
||||||
activate_flarum_extension $db_name "qiaeru-lang-french"
|
activate_flarum_extension $db_name "qiaeru-lang-french"
|
||||||
sql_command="UPDATE \`settings\` SET \`value\` = 'fr' WHERE \`settings\`.\`key\` = 'default_locale'"
|
sql_command="UPDATE \`settings\` SET \`value\` = 'fr' WHERE \`settings\`.\`key\` = 'default_locale'"
|
||||||
ynh_mysql_execute_as_root --sql="$sql_command" --database=$db_name
|
ynh_mysql_db_shell <<< "$sql_command"
|
||||||
|
|
||||||
;;
|
;;
|
||||||
de)
|
de)
|
||||||
ynh_script_progression --message="Installing German extension..." --weight=2
|
ynh_script_progression "Installing German extension..."
|
||||||
ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$install_dir --commands="require kakifrucht/flarum-de:*"
|
ynh_composer_exec require kakifrucht/flarum-de:*
|
||||||
activate_flarum_extension $db_name "kakifrucht-de"
|
activate_flarum_extension $db_name "kakifrucht-de"
|
||||||
sql_command="UPDATE \`settings\` SET \`value\` = 'de' WHERE \`settings\`.\`key\` = 'default_locale'"
|
sql_command="UPDATE \`settings\` SET \`value\` = 'de' WHERE \`settings\`.\`key\` = 'default_locale'"
|
||||||
ynh_mysql_execute_as_root --sql="$sql_command" --database=$db_name
|
ynh_mysql_db_shell <<< "$sql_command"
|
||||||
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Set files and directories permissions
|
# Set files and directories permissions
|
||||||
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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed"
|
ynh_script_progression "Installation of $app completed"
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source experimental_helpers/ynh_add_swap
|
source experimental_helpers/ynh_add_swap
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
@ -14,14 +8,15 @@ 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..."
|
||||||
|
|
||||||
ynh_remove_nginx_config
|
ynh_config_remove_nginx
|
||||||
|
|
||||||
ynh_remove_fpm_config
|
ynh_config_remove_phpfpm
|
||||||
|
|
||||||
ynh_remove_logrotate
|
ynh_config_remove_logrotate
|
||||||
|
|
||||||
ynh_del_swap
|
ynh_del_swap
|
||||||
|
|
||||||
|
@ -29,4 +24,4 @@ ynh_del_swap
|
||||||
# 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 ../settings/scripts/experimental_helpers/ynh_add_swap
|
source ../settings/scripts/experimental_helpers/ynh_add_swap
|
||||||
|
@ -16,54 +10,51 @@ 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 -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 | 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"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the MySQL database..."
|
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"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD SWAP
|
# ADD SWAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding swap..."
|
ynh_script_progression "Adding swap..."
|
||||||
|
|
||||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then
|
if ! ynh_in_ci_tests; then
|
||||||
ynh_add_swap --size=$swap_needed
|
ynh_add_swap --size=$swap_needed
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
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"
|
||||||
|
|
118
scripts/upgrade
118
scripts/upgrade
|
@ -1,64 +1,54 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source experimental_helpers/ynh_add_swap
|
source experimental_helpers/ynh_add_swap
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
ynh_app_setting_set_default --key=php_upload_max_filesize --value=100M
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
ynh_script_progression "Loading installation settings..."
|
||||||
|
|
||||||
old_core_version=$(ynh_app_setting_get --app=$app --key=core_version)
|
old_core_version=$(ynh_app_setting_get --key=core_version)
|
||||||
core_version=$(ynh_app_upstream_version)
|
core_version=$(ynh_app_upstream_version)
|
||||||
|
|
||||||
#=================================================
|
ynh_script_progression "Checking version..."
|
||||||
# CHECK VERSION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Checking version..."
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD UPGRADE STEPS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
ynh_script_progression "Ensuring downward compatibility..."
|
||||||
|
|
||||||
# Remove bazaar_extension if it exists
|
# Remove bazaar_extension if it exists
|
||||||
bazaar_extension=$(ynh_app_setting_get --app=$app --key=bazaar_extension)
|
bazaar_extension=$(ynh_app_setting_get --key=bazaar_extension)
|
||||||
if [ ! -z "$bazaar_extension" ]; then
|
if [ ! -z "$bazaar_extension" ]; then
|
||||||
ynh_app_setting_delete --app=$app --key=bazaar_extension
|
ynh_app_setting_delete --key=bazaar_extension
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove SSOwat extension if it exists
|
# Remove SSOwat extension if it exists
|
||||||
ssowat_extension=$(ynh_app_setting_get --app=$app --key=ssowat_extension)
|
ssowat_extension=$(ynh_app_setting_get --key=ssowat_extension)
|
||||||
if [ ! -z "$ssowat_extension" ]; then
|
if [ ! -z "$ssowat_extension" ]; then
|
||||||
ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$install_dir --commands="remove tituspijean/flarum-ext-auth-ssowat"
|
ynh_composer_exec remove tituspijean/flarum-ext-auth-ssowat
|
||||||
ynh_app_setting_delete --app=$app --key=ssowat_extension
|
ynh_app_setting_delete --key=ssowat_extension
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ] && ynh_compare_current_package_version --comparison lt --version 1.0~ynh1
|
# 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 && ynh_app_upgrading_from_version_before 1.0~ynh1
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..."
|
ynh_script_progression "Upgrading source files..."
|
||||||
|
|
||||||
# Create a temporary directory
|
# Create a temporary directory
|
||||||
tmpdir="$(mktemp -d)"
|
tmpdir="$(mktemp -d)"
|
||||||
cp -R $install_dir/* $tmpdir
|
cp -R $install_dir/* $tmpdir
|
||||||
|
|
||||||
# Deleting current app directory
|
# Deleting current app directory
|
||||||
ynh_secure_remove --file="$install_dir"
|
ynh_safe_rm "$install_dir"
|
||||||
|
|
||||||
# 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" --source_id="flarum"
|
ynh_setup_source --dest_dir="$install_dir" --source_id="flarum"
|
||||||
|
@ -75,32 +65,29 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean temp directory
|
# Clean temp directory
|
||||||
ynh_secure_remove --file="$tmpdir"
|
ynh_safe_rm "$tmpdir"
|
||||||
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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=1
|
ynh_script_progression "Upgrading php-fpm configuration..."
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC UPGRADE
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD SWAP
|
# ADD SWAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding swap..."
|
ynh_script_progression "Adding swap..."
|
||||||
|
|
||||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then
|
if ! ynh_in_ci_tests; then
|
||||||
ynh_add_swap --size=$swap_needed
|
ynh_add_swap --size=$swap_needed
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -108,14 +95,14 @@ fi
|
||||||
# COMPOSER AND FLARUM UPGRADE
|
# COMPOSER AND FLARUM UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
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="Installing composer dependencies..." --weight=5
|
ynh_script_progression "Installing composer dependencies..."
|
||||||
|
|
||||||
# Set right permissions
|
# Set right permissions
|
||||||
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
|
||||||
|
if ynh_app_upgrading_from_version_before 1.1.0~ynh1
|
||||||
if ynh_compare_current_package_version --comparison lt --version 1.1.0~ynh1
|
|
||||||
then
|
then
|
||||||
# Starting 1.0 (implemented for 1.1 in the package), version requirement is "*" for extensions
|
# Starting 1.0 (implemented for 1.1 in the package), version requirement is "*" for extensions
|
||||||
# ... except for flarum/core, but that's handled in the next block.
|
# ... except for flarum/core, but that's handled in the next block.
|
||||||
|
@ -124,11 +111,11 @@ then
|
||||||
|
|
||||||
# Perform migrations and clear cache
|
# Perform migrations and clear cache
|
||||||
pushd $install_dir
|
pushd $install_dir
|
||||||
ynh_script_progression --message="Upgrading Flarum and its extensions..." --weight=1
|
ynh_script_progression "Upgrading Flarum and its extensions..."
|
||||||
ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$install_dir --commands="require tituspijean/flarum-ext-auth-ldap:$ldap_version --no-update"
|
ynh_composer_exec require tituspijean/flarum-ext-auth-ldap:$ldap_version --no-update
|
||||||
ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$install_dir --commands="require flarum/core:$core_version --prefer-dist --update-no-dev -a --update-with-all-dependencies"
|
ynh_composer_exec require flarum/core:$core_version --prefer-dist --update-no-dev -a --update-with-all-dependencies
|
||||||
ynh_exec_as $app php$phpversion flarum migrate
|
ynh_exec_as_app php$php_version flarum migrate
|
||||||
ynh_exec_as $app php$phpversion flarum cache:clear
|
ynh_exec_as_app php$php_version flarum cache:clear
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -138,30 +125,32 @@ ynh_app_setting_set $app core_version "$core_version"
|
||||||
# FLARUM EXTENSIONS
|
# FLARUM EXTENSIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if ! ynh_exec_as $app php$phpversion flarum info | grep -q "tituspijean-auth-ldap" | grep -q $ldap_version;
|
if ! ynh_exec_as_app php$php_version flarum info | grep -q "tituspijean-auth-ldap" | grep -q $ldap_version;
|
||||||
then
|
then
|
||||||
# Install and activate the LDAP auth extension
|
# Install and activate the LDAP auth extension
|
||||||
activate_flarum_extension $db_name "tituspijean-auth-ldap"
|
activate_flarum_extension $db_name "tituspijean-auth-ldap"
|
||||||
# Configure LDAP auth extension
|
# Configure LDAP auth extension
|
||||||
ynh_add_config --template="../conf/ldap.sql.template" --destination="../conf/ldap.sql"
|
ynh_config_add --template="ldap.sql.template" --destination="../conf/ldap.sql"
|
||||||
ynh_mysql_connect_as --user=$app --password="$db_pwd" --database=$db_name < ../conf/ldap.sql
|
ynh_mysql_db_shell < ../conf/ldap.sql
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install, activate and set language extensions
|
# Install, activate and set language extensions
|
||||||
case $language in
|
case $language in
|
||||||
fr)
|
fr)
|
||||||
ynh_script_progression --message="Installing French extension..." --weight=2
|
ynh_script_progression "Installing French extension..."
|
||||||
ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$install_dir --commands="require qiaeru/lang-french:*"
|
ynh_composer_exec require qiaeru/lang-french:*
|
||||||
activate_flarum_extension $db_name "qiaeru-lang-french"
|
activate_flarum_extension $db_name "qiaeru-lang-french"
|
||||||
sql_command="UPDATE \`settings\` SET \`value\` = 'fr' WHERE \`settings\`.\`key\` = 'default_locale'"
|
sql_command="UPDATE \`settings\` SET \`value\` = 'fr' WHERE \`settings\`.\`key\` = 'default_locale'"
|
||||||
ynh_mysql_execute_as_root --sql="$sql_command" --database=$db_name
|
ynh_mysql_db_shell <<< "$sql_command"
|
||||||
|
|
||||||
;;
|
;;
|
||||||
de)
|
de)
|
||||||
ynh_script_progression --message="Installing German extension..." --weight=2
|
ynh_script_progression "Installing German extension..."
|
||||||
ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$install_dir --commands="require kakifrucht/flarum-de:*"
|
ynh_composer_exec require kakifrucht/flarum-de:*
|
||||||
activate_flarum_extension $db_name "kakifrucht-de"
|
activate_flarum_extension $db_name "kakifrucht-de"
|
||||||
sql_command="UPDATE \`settings\` SET \`value\` = 'de' WHERE \`settings\`.\`key\` = 'default_locale'"
|
sql_command="UPDATE \`settings\` SET \`value\` = 'de' WHERE \`settings\`.\`key\` = 'default_locale'"
|
||||||
ynh_mysql_execute_as_root --sql="$sql_command" --database=$db_name
|
ynh_mysql_db_shell <<< "$sql_command"
|
||||||
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -169,26 +158,23 @@ ynh_print_info "You may need to manually enable your language extension in Flaru
|
||||||
|
|
||||||
# Clear cache
|
# Clear cache
|
||||||
pushd $install_dir
|
pushd $install_dir
|
||||||
ynh_exec_as $app php$phpversion flarum cache:clear
|
ynh_exec_as_app php$php_version flarum cache:clear
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# Set files and directories permissions
|
# Set files and directories permissions
|
||||||
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"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
ynh_script_progression "Upgrading logrotate configuration..."
|
||||||
|
|
||||||
# Use logrotate to manage app-specific logfile(s)
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
ynh_use_logrotate --non-append
|
ynh_config_add_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
ynh_script_progression "Upgrade of $app completed"
|
||||||
|
|
Loading…
Add table
Reference in a new issue