1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/joomla_ynh.git synced 2024-09-03 19:26:34 +02:00
joomla_ynh/scripts/upgrade
2024-02-01 20:51:06 +01:00

88 lines
2.6 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# If secret doesn't exist, create it
if [ -z "$secret" ]; then
secret=""
ynh_app_setting_set --app=$app --key=secret --value=$secret
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep="configuration.php"
# Run internal update of joomla fixing missing database tables
pushd "$install_dir"
php$phpversion cli/joomla.php core:update
popd
# Remove installation directory
ynh_secure_remove --file="$install_dir/installation"
fi
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
# Create a dedicated NGINX config
ynh_add_nginx_config
mkdir -p "/var/log/$app"
chmod 750 "/var/log/$app"
chmod -R o-rwx "/var/log/$app"
chown -R $app:www-data "/var/log/$app"
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
#=================================================
# SPECIFIC UPGRADE
#=================================================
# RESTORE A CONFIG FILE
#=================================================
# ynh_script_progression --message="Restoring configuration file..."
# ynh_add_config --template="configuration.php" --destination="$install_dir/configuration.php"
# chmod 400 "$install_dir/configuration.php"
# chown $app:$app "$install_dir/configuration.php"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed"