mirror of
https://github.com/YunoHost-Apps/humhub_ynh.git
synced 2024-09-03 19:26:11 +02:00
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
parent
d3b4b68e24
commit
fcd06b7ab0
14 changed files with 129 additions and 331 deletions
|
@ -1,2 +1,2 @@
|
|||
* * * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/protected/yii queue/run >/dev/null 2>&1
|
||||
* * * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/protected/yii cron/run >/dev/null 2>&1
|
||||
* * * * * __APP__ /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/protected/yii queue/run >/dev/null 2>&1
|
||||
* * * * * __APP__ /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/protected/yii cron/run >/dev/null 2>&1
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
; Additional php.ini defines, specific to this pool of workers.
|
||||
|
||||
php_admin_value[upload_max_filesize] = 1G
|
||||
php_admin_value[post_max_size] = 1G
|
|
@ -18,7 +18,7 @@ location __PATH__/ {
|
|||
set $fsn $fastcgi_script_name;
|
||||
}
|
||||
|
||||
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;
|
||||
include fastcgi_params;
|
||||
fastcgi_param REMOTE_USER $remote_user;
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
version = "1.0"
|
||||
|
||||
[main]
|
||||
name = "HumHub configuration"
|
||||
|
||||
[main.php_fpm_config]
|
||||
name = "PHP-FPM configuration"
|
||||
|
||||
[main.php_fpm_config.fpm_footprint]
|
||||
ask = "Memory footprint"
|
||||
type = "select"
|
||||
choices.low = "Low, <= 20Mb per pool"
|
||||
choices.medium = "Medium, between 20Mb and 40Mb per pool"
|
||||
choices.high = "High, > 40Mb per pool"
|
||||
choices.specific = "Use specific value"
|
||||
default = "low"
|
||||
|
||||
[main.php_fpm_config.fpm_free_footprint]
|
||||
visible = "fpm_footprint == 'specific'"
|
||||
ask = "Memory footprint of the service?"
|
||||
type = "number"
|
||||
default = "0"
|
||||
help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values."
|
||||
|
||||
[main.php_fpm_config.fpm_usage]
|
||||
ask = "Expected usage"
|
||||
type = "select"
|
||||
choices = ["low", "medium", "high"]
|
||||
default = "low"
|
||||
help = "low: Personal usage, behind the SSO. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."
|
|
@ -17,7 +17,8 @@ admindoc = "https://docs.humhub.org"
|
|||
code = "https://github.com/humhub/humhub"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
yunohost = ">= 11.2.18"
|
||||
helpers_version = "2.1"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
|
||||
|
@ -52,6 +53,7 @@ ram.runtime = "50M"
|
|||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
group = "www-data:r-x"
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||
#=================================================
|
||||
|
||||
HUMHUB_AUTH_BASIC_VERSION=0.2.0
|
||||
HUMHUB_AUTH_BASIC_PATH="/protected/modules/auth-basic"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
local_curl_csrf () {
|
||||
# Define url of page to curl
|
||||
local local_page=$1
|
||||
|
@ -76,13 +72,5 @@ install_sso() {
|
|||
tar xf $tmp_auth_basic_module -C $install_dir/protected/modules
|
||||
mv $install_dir/protected/modules/humhub-auth-basic* $install_dir/$HUMHUB_AUTH_BASIC_PATH
|
||||
|
||||
ynh_secure_remove $tmp_auth_basic_module
|
||||
ynh_safe_rm $tmp_auth_basic_module
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -1,37 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
ynh_print_info "Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$install_dir"
|
||||
ynh_backup "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
|
||||
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
|
||||
|
@ -39,17 +30,17 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|||
# BACKUP VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/cron.d/$app"
|
||||
ynh_backup "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
|
||||
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,32 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||
ynh_script_progression "Updating NGINX web server configuration..."
|
||||
|
||||
ynh_change_url_nginx_config
|
||||
ynh_config_change_url_nginx
|
||||
|
||||
#=================================================
|
||||
# UPDATE HUMHUB CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating HUMHUB configuration..." --weight=1
|
||||
ynh_script_progression "Updating HUMHUB configuration..."
|
||||
|
||||
pushd $install_dir/protected
|
||||
php$phpversion yii settings/set base baseUrl http://$new_domain$new_path
|
||||
php$php_version yii settings/set base baseUrl http://$new_domain$new_path
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||
ynh_script_progression "Change of URL completed for $app"
|
||||
|
|
|
@ -1,95 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
||||
#=================================================
|
||||
|
||||
get__fpm_footprint() {
|
||||
# Free footprint value for php-fpm
|
||||
# Check if current_fpm_footprint is an integer
|
||||
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
|
||||
then
|
||||
echo "specific"
|
||||
else
|
||||
echo "$current_fpm_footprint"
|
||||
fi
|
||||
}
|
||||
|
||||
get__free_footprint() {
|
||||
# Free footprint value for php-fpm
|
||||
# Check if current_fpm_footprint is an integer
|
||||
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
|
||||
then
|
||||
# If current_fpm_footprint is an integer, that's a numeric value for the footprint
|
||||
echo "$current_fpm_footprint"
|
||||
else
|
||||
echo "0"
|
||||
fi
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
||||
#=================================================
|
||||
|
||||
set__fpm_footprint() {
|
||||
if [ "$fpm_footprint" != "specific" ]
|
||||
then
|
||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint"
|
||||
fi
|
||||
}
|
||||
|
||||
set__fpm_free_footprint() {
|
||||
if [ "$fpm_footprint" = "specific" ]
|
||||
then
|
||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_free_footprint"
|
||||
fi
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
||||
ynh_app_config_validate() {
|
||||
_ynh_app_config_validate
|
||||
|
||||
if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[fpm_free_footprint]}" == "true" ]; then
|
||||
# If fpm_footprint is set to 'specific', use $fpm_free_footprint value.
|
||||
if [ "$fpm_footprint" = "specific" ]
|
||||
then
|
||||
fpm_footprint=$fpm_free_footprint
|
||||
fi
|
||||
|
||||
if [ "$fpm_footprint" == "0" ]
|
||||
then
|
||||
ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
|
||||
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
ynh_app_config_apply() {
|
||||
_ynh_app_config_apply
|
||||
|
||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
}
|
||||
|
||||
ynh_app_config_run $1
|
113
scripts/install
113
scripts/install
|
@ -1,48 +1,43 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_app_setting_set --key=php_upload_max_filesize --value=1G
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
fpm_footprint="low"
|
||||
fpm_free_footprint=0
|
||||
fpm_usage="low"
|
||||
#REMOVEME? Everything about fpm_footprint is removed in helpers2.1... | fpm_footprint="low"
|
||||
#REMOVEME? Everything about fpm_free_footprint is removed in helpers2.1... | fpm_free_footprint=0
|
||||
#REMOVEME? Everything about fpm_usage is removed in helpers2.1... | fpm_usage="low"
|
||||
|
||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
|
||||
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
|
||||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
||||
#REMOVEME? Everything about fpm_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_footprint --value=$fpm_footprint
|
||||
#REMOVEME? Everything about fpm_free_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_free_footprint --value=$fpm_free_footprint
|
||||
#REMOVEME? Everything about fpm_usage is removed in helpers2.1... | ynh_app_setting_set --key=fpm_usage --value=$fpm_usage
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||
ynh_script_progression "Setting up source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
|
||||
chmod 750 "$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 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"
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
|
||||
ynh_script_progression "Configuring PHP-FPM..."
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
ynh_config_add_phpfpm
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
|
@ -50,57 +45,56 @@ ynh_add_nginx_config
|
|||
# SETUP SQL CREDENTIALS
|
||||
#=================================================
|
||||
|
||||
ynh_add_config --template="common.php" --destination="$install_dir/protected/config/common.php"
|
||||
ynh_config_add --template="common.php" --destination="$install_dir/protected/config/common.php"
|
||||
|
||||
#=================================================
|
||||
# DEACTIVATE DEBUG MODE
|
||||
#=================================================
|
||||
|
||||
ynh_replace_string --match_string="defined('YII_DEBUG') or define('YII_DEBUG', true);"\
|
||||
--replace_string="// defined('YII_DEBUG') or define('YII_DEBUG', true);"\
|
||||
--target_file="$install_dir/index.php"
|
||||
ynh_replace_string --match_string="defined('YII_ENV') or define('YII_ENV', 'dev');"\
|
||||
--replace_string="// defined('YII_ENV') or define('YII_ENV', 'dev');"\
|
||||
--target_file="$install_dir/index.php"
|
||||
ynh_replace --match="defined('YII_DEBUG') or define('YII_DEBUG', true);"\
|
||||
--replace="// defined('YII_DEBUG') or define('YII_DEBUG', true);"\
|
||||
--file="$install_dir/index.php"
|
||||
ynh_replace --match="defined('YII_ENV') or define('YII_ENV', 'dev');"\
|
||||
--replace="// defined('YII_ENV') or define('YII_ENV', 'dev');"\
|
||||
--file="$install_dir/index.php"
|
||||
|
||||
#=================================================
|
||||
# SETUP APPLICATION WITH CURL
|
||||
#=================================================
|
||||
|
||||
# Set right permissions for curl install
|
||||
chown -R $app: $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: $install_dir
|
||||
# Set the app as temporarily public for curl call
|
||||
ynh_script_progression --message="Configuring SSOwat..." --weight=30
|
||||
ynh_script_progression "Configuring SSOwat..."
|
||||
|
||||
# Reload SSOwat config
|
||||
yunohost app ssowatconf
|
||||
|
||||
# Installation with curl
|
||||
ynh_script_progression --message="Finalizing installation..." --weight=2
|
||||
ynh_script_progression "Finalizing installation..."
|
||||
|
||||
install_sso
|
||||
|
||||
pushd $install_dir/protected
|
||||
php$phpversion yii migrate/up --includeModuleMigrations=1 --interactive=0
|
||||
php$php_version yii migrate/up --includeModuleMigrations=1 --interactive=0
|
||||
|
||||
php$phpversion yii settings/set ldap enabled '1'
|
||||
php$phpversion yii settings/set ldap hostname 'localhost'
|
||||
php$phpversion yii settings/set ldap port 389
|
||||
php$phpversion yii settings/set ldap encryption ''
|
||||
php$phpversion yii settings/set ldap username ''
|
||||
php$phpversion yii settings/set ldap password ''
|
||||
php$phpversion yii settings/set ldap baseDn 'ou=users,dc=yunohost,dc=org'
|
||||
php$phpversion yii settings/set ldap loginFilter '(uid=%s)'
|
||||
php$phpversion yii settings/set ldap userFilter 'objectClass=mailAccount'
|
||||
php$phpversion yii settings/set ldap emailAttribute 'mail'
|
||||
php$phpversion yii settings/set ldap usernameAttribute 'uid'
|
||||
php$phpversion yii settings/set ldap idAttribute 'uid'
|
||||
php$phpversion yii settings/set ldap refreshUsers '1'
|
||||
php$phpversion yii settings/set ldap refreshUsers '1'
|
||||
php$php_version yii settings/set ldap enabled '1'
|
||||
php$php_version yii settings/set ldap hostname 'localhost'
|
||||
php$php_version yii settings/set ldap port 389
|
||||
php$php_version yii settings/set ldap encryption ''
|
||||
php$php_version yii settings/set ldap username ''
|
||||
php$php_version yii settings/set ldap password ''
|
||||
php$php_version yii settings/set ldap baseDn 'ou=users,dc=yunohost,dc=org'
|
||||
php$php_version yii settings/set ldap loginFilter '(uid=%s)'
|
||||
php$php_version yii settings/set ldap userFilter 'objectClass=mailAccount'
|
||||
php$php_version yii settings/set ldap emailAttribute 'mail'
|
||||
php$php_version yii settings/set ldap usernameAttribute 'uid'
|
||||
php$php_version yii settings/set ldap idAttribute 'uid'
|
||||
php$php_version yii settings/set ldap refreshUsers '1'
|
||||
php$php_version yii settings/set ldap refreshUsers '1'
|
||||
|
||||
php$phpversion yii ldap/sync
|
||||
php$phpversion yii user/make-admin ${admin}
|
||||
php$php_version yii ldap/sync
|
||||
php$php_version yii user/make-admin ${admin}
|
||||
|
||||
ynh_local_curl "/index.php?r=installer/index/go"
|
||||
|
||||
|
@ -114,29 +108,28 @@ pushd $install_dir/protected
|
|||
local_curl_csrf "/index.php?r=installer/config/sample-data" \
|
||||
"SampleDataForm[sampleData]=0"
|
||||
|
||||
php$phpversion yii settings/set user auth.anonymousRegistration '0'
|
||||
php$phpversion yii settings/set user auth.allowGuestAccess '0'
|
||||
php$phpversion yii settings/set user auth.internalUsersCanInvite '0'
|
||||
php$php_version yii settings/set user auth.anonymousRegistration '0'
|
||||
php$php_version yii settings/set user auth.allowGuestAccess '0'
|
||||
php$php_version yii settings/set user auth.internalUsersCanInvite '0'
|
||||
|
||||
php$phpversion yii module/enable auth-basic
|
||||
php$php_version yii module/enable auth-basic
|
||||
|
||||
popd
|
||||
|
||||
ynh_store_file_checksum --file="$install_dir/protected/config/common.php"
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
ynh_store_file_checksum "$install_dir/protected/config/common.php"
|
||||
|
||||
#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"
|
||||
#=================================================
|
||||
# SETUP CRON CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setuping crontab..." --weight=1
|
||||
ynh_script_progression "Setuping crontab..."
|
||||
|
||||
ynh_add_config --template="cron" --destination="/etc/cron.d/${app}"
|
||||
ynh_config_add --template="cron" --destination="/etc/cron.d/${app}"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
ynh_script_progression "Installation of $app completed"
|
||||
|
|
|
@ -1,30 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
ynh_script_progression "Removing system configurations related to $app..."
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
ynh_config_remove_nginx
|
||||
|
||||
# Remove the dedicated PHP-FPM config
|
||||
ynh_remove_fpm_config
|
||||
ynh_config_remove_phpfpm
|
||||
|
||||
# Remove a cron file
|
||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
ynh_safe_rm "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
@ -13,44 +7,41 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# 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"
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
ynh_restore "$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"
|
||||
#=================================================
|
||||
# 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 THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=5
|
||||
ynh_script_progression "Restoring the PHP-FPM configuration..."
|
||||
|
||||
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/cron.d/$app"
|
||||
ynh_restore "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# 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_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemctl --service=php$php_version-fpm --action=reload
|
||||
ynh_systemctl --service=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
ynh_script_progression "Restoration completed for $app"
|
||||
|
|
|
@ -1,43 +1,31 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_app_setting_set_default --key=php_upload_max_filesize --value=1G
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
ynh_script_progression "Ensuring downward compatibility..."
|
||||
|
||||
# If fpm_footprint doesn't exist, create it
|
||||
if [ -z "${fpm_footprint:-}" ]; then
|
||||
fpm_footprint=low
|
||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
|
||||
#REMOVEME? Everything about fpm_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_footprint --value=$fpm_footprint
|
||||
fi
|
||||
|
||||
# If fpm_free_footprint doesn't exist, create it
|
||||
if [ -z "${fpm_free_footprint:-}" ]; then
|
||||
fpm_free_footprint=0
|
||||
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
|
||||
#REMOVEME? Everything about fpm_free_footprint is removed in helpers2.1... | ynh_app_setting_set --key=fpm_free_footprint --value=$fpm_free_footprint
|
||||
fi
|
||||
|
||||
# If fpm_usage doesn't exist, create it
|
||||
if [ -z "${fpm_usage:-}" ]; then
|
||||
fpm_usage=low
|
||||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
||||
#REMOVEME? Everything about fpm_usage is removed in helpers2.1... | ynh_app_setting_set --key=fpm_usage --value=$fpm_usage
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -45,11 +33,12 @@ fi
|
|||
#=================================================
|
||||
|
||||
# Deactivate cron jobs
|
||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
ynh_safe_rm "/etc/cron.d/$app"
|
||||
|
||||
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
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
ynh_script_progression "Upgrading source files..."
|
||||
|
||||
# Backup user contents
|
||||
mv "$install_dir" "$install_dir.old"
|
||||
|
@ -65,51 +54,50 @@ then
|
|||
cp -a "$install_dir.old/themes/." "$install_dir/themes/"
|
||||
|
||||
# Delete old source
|
||||
ynh_secure_remove --file="$install_dir.old"
|
||||
ynh_safe_rm "$install_dir.old"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
ynh_config_add_phpfpm
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# DEACTIVATE DEBUG MODE
|
||||
#=================================================
|
||||
|
||||
ynh_replace_string --match_string="defined('YII_DEBUG') or define('YII_DEBUG', true);"\
|
||||
--replace_string="// defined('YII_DEBUG') or define('YII_DEBUG', true);"\
|
||||
--target_file="$install_dir/index.php"
|
||||
ynh_replace_string --match_string="defined('YII_ENV') or define('YII_ENV', 'dev');"\
|
||||
--replace_string="// defined('YII_ENV') or define('YII_ENV', 'dev');"\
|
||||
--target_file="$install_dir/index.php"
|
||||
ynh_replace --match="defined('YII_DEBUG') or define('YII_DEBUG', true);"\
|
||||
--replace="// defined('YII_DEBUG') or define('YII_DEBUG', true);"\
|
||||
--file="$install_dir/index.php"
|
||||
ynh_replace --match="defined('YII_ENV') or define('YII_ENV', 'dev');"\
|
||||
--replace="// defined('YII_ENV') or define('YII_ENV', 'dev');"\
|
||||
--file="$install_dir/index.php"
|
||||
|
||||
#=================================================
|
||||
# SETUP APPLICATION
|
||||
#=================================================
|
||||
|
||||
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
|
||||
ynh_script_progression --message="Setuping application..." --weight=1
|
||||
ynh_script_progression "Setuping application..."
|
||||
|
||||
if [[ ! -d $install_dir/$HUMHUB_AUTH_BASIC_PATH ]]; then
|
||||
install_sso
|
||||
|
||||
pushd $install_dir/protected
|
||||
php$phpversion yii module/enable auth-basic
|
||||
php$php_version yii module/enable auth-basic
|
||||
popd
|
||||
else
|
||||
current_version=$(cat $install_dir/$HUMHUB_AUTH_BASIC_PATH/module.json | jq -j '.version')
|
||||
if [ "$current_version" != "$HUMHUB_AUTH_BASIC_VERSION" ]; then
|
||||
ynh_secure_remove $install_dir/$HUMHUB_AUTH_BASIC_PATH
|
||||
ynh_safe_rm $install_dir/$HUMHUB_AUTH_BASIC_PATH
|
||||
install_sso
|
||||
fi
|
||||
fi
|
||||
|
@ -118,32 +106,31 @@ fi
|
|||
#=================================================
|
||||
# MIGRATE DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Migrating database..." --weight=1
|
||||
ynh_script_progression "Migrating database..."
|
||||
|
||||
chown -R $app $install_dir/
|
||||
|
||||
ynh_exec_as $app /usr/bin/php$phpversion $install_dir/protected/yii migrate/up --includeModuleMigrations=1 --interactive=0
|
||||
ynh_exec_as_app /usr/bin/php$php_version $install_dir/protected/yii migrate/up --includeModuleMigrations=1 --interactive=0
|
||||
|
||||
#=================================================
|
||||
# UPDATE MODULES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating modules..." --weight=1
|
||||
ynh_script_progression "Updating modules..."
|
||||
|
||||
ynh_exec_as $app /usr/bin/php$phpversion $install_dir/protected/yii module/update-all --interactive=0
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
ynh_exec_as_app /usr/bin/php$php_version $install_dir/protected/yii module/update-all --interactive=0
|
||||
|
||||
#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"
|
||||
#=================================================
|
||||
# UPGRADE CRONTAB
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading crontab..." --weight=1
|
||||
ynh_script_progression "Upgrading crontab..."
|
||||
|
||||
ynh_add_config --template="cron" --destination="/etc/cron.d/${app}"
|
||||
ynh_config_add --template="cron" --destination="/etc/cron.d/${app}"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
ynh_script_progression "Upgrade of $app completed"
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/protected/humhub/modules/ldap/models/LdapSettings.php b/protected/humhub/modules/ldap/models/LdapSettings.php
|
||||
index e6402e8b3..3b653d590 100644
|
||||
--- a/protected/humhub/modules/ldap/models/LdapSettings.php
|
||||
+++ b/protected/humhub/modules/ldap/models/LdapSettings.php
|
||||
@@ -125,7 +125,7 @@ class LdapSettings extends Model
|
||||
return [
|
||||
[['enabled', 'refreshUsers', 'usernameAttribute', 'emailAttribute', 'username', 'passwordField', 'hostname', 'port', 'idAttribute'], 'string', 'max' => 255],
|
||||
[['baseDn', 'loginFilter', 'userFilter', 'ignoredDNs'], 'string'],
|
||||
- [['usernameAttribute', 'username', 'passwordField', 'hostname', 'port', 'baseDn', 'loginFilter', 'userFilter', 'idAttribute'], 'required'],
|
||||
+ [['usernameAttribute', 'hostname', 'port', 'baseDn', 'loginFilter', 'userFilter', 'idAttribute'], 'required'],
|
||||
['encryption', 'in', 'range' => ['', 'ssl', 'tls']],
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue