1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yeswiki_ynh.git synced 2024-09-03 18:05:56 +02:00
This commit is contained in:
Éric Gaspar 2024-06-13 16:49:41 +02:00
parent 3c76352832
commit c27e334e77
5 changed files with 34 additions and 52 deletions

View file

@ -22,15 +22,11 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_backup --src_path="/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"
#=================================================

View file

@ -21,9 +21,9 @@ chown -R $app:www-data $install_dir
chmod -R u=rwX,g=rX,o-rwx $install_dir
#=================================================
# PHP-FPM CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
@ -36,7 +36,7 @@ ynh_add_nginx_config
#=================================================
# INSTALL COMPOSER DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing composer dependencies..."
ynh_script_progression --message="Installing Composer dependencies..."
ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$install_dir"
@ -84,7 +84,7 @@ ynh_setup_source --dest_dir="$install_dir/tools/importer" --source_id="importerp
#=================================================
# DOWNLOAD AND CONFIGURE YUNOHOST PLUGIN
#=================================================
ynh_script_progression --message="Configure yunohost plugin" --weight=2
ynh_script_progression --message="Configure YunoHost plugin" --weight=2
# Download yeswiki plugin from yeswiki repository
mkdir -p "$install_dir/tools/yunohost"
@ -109,20 +109,20 @@ pushd $install_dir
ynh_exec_as $app ./yeswicli importer:sync -s yunohost-cli
popd
#=================================================
# CONFIGURE YUNOHOST PLUGIN
#=================================================
if [ "${authprovider}" = "Yunohost SSO" ]; then
#=================================================
# CONFIGURE YUNOHOST PLUGIN
#=================================================
ynh_script_progression --message="Enable YunoHost SSO" --weight=1
# Add config at the end of wakka.config.php
ynh_replace_string --match_string=");" --replace_string=" 'enable_yunohost_sso' => true,\n);" --target_file="$install_dir/wakka.config.php"
fi
#=================================================
# DOWNLOAD AND CONFIGURE FERME PLUGIN
#=================================================
if [ "${wikimodel}" = "CLIC" ]; then
#=================================================
# DOWNLOAD AND CONFIGURE FERME PLUGIN
#=================================================
ynh_script_progression --message="Configure ferme plugin" --weight=2
# Download ferme plugin from yeswiki repository

View file

@ -10,9 +10,9 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# REMOVE NGINX CONFIGURATION
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config

View file

@ -21,20 +21,6 @@ chown -R $app:www-data $install_dir
chmod -R u=rwX,g=rX,o-rwx $install_dir
chmod g-rwx $install_dir/wakka.config.php
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=11
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
@ -42,6 +28,15 @@ ynh_script_progression --message="Restoring the MySQL database..." --weight=3
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -9,30 +9,21 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=5
if [ "$upgrade_type" == "UPGRADE_APP" ]; then
ynh_script_progression --message="Upgrading source files..." --weight=5
# Download, check integrity, uncompress and patch the source from app.src
# TODO : find a way to sync stable extensions list to avoid hardcoded extensions folders to keep
noncore_extensions="$(echo tools/{accountactivationbyemail,advancedsearch,benevolat,ferme,fontautoinstall,importer,ipblock,lms,login-sso,logincas,loginldap,maintenance,multideletepages,nextcloudconnector,publication,qrcode,stats,tabdyn,twolevels,webhooks,yunohost})"
ferme_instances="$(
# Download, check integrity, uncompress and patch the source from app.src
# TODO : find a way to sync stable extensions list to avoid hardcoded extensions folders to keep
noncore_extensions="$(echo tools/{accountactivationbyemail,advancedsearch,benevolat,ferme,fontautoinstall,importer,ipblock,lms,login-sso,logincas,loginldap,maintenance,multideletepages,nextcloudconnector,publication,qrcode,stats,tabdyn,twolevels,webhooks,yunohost})"
ferme_instances="$(
cd $install_dir
for p in $(ls -- */wakka.config.php 2>/dev/null); do dirname "$p"; done
)"
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=".env wakka.config.php files custom private themes $noncore_extensions $ferme_instances"
)"
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=".env wakka.config.php files custom private themes $noncore_extensions $ferme_instances"
ynh_replace_string --match_string="yeswiki_release' \?=> \?'.*',$" --replace_string="yeswiki_release' => '$(ynh_app_upstream_version)'," --target_file="$install_dir/wakka.config.php"
fi
ynh_replace_string --match_string="yeswiki_release' \?=> \?'.*',$" --replace_string="yeswiki_release' => '$(ynh_app_upstream_version)'," --target_file="$install_dir/wakka.config.php"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -53,7 +44,7 @@ ynh_add_nginx_config
#=================================================
# INSTALL COMPOSER DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing composer dependencies..."
ynh_script_progression --message="Installing Composer dependencies..."
ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$install_dir"
@ -61,7 +52,7 @@ ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$i
# DOWNLOAD AND CONFIGURE YUNOHOST PLUGIN
#=================================================
ynh_script_progression --message="Upgrading Yunohost plugin..." --weight=3
ynh_script_progression --message="Upgrading YunoHost plugin..." --weight=3
# Download yunohost plugin from yeswiki repository
ynh_secure_remove "$install_dir/tools/yunohost"