1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/matomo_ynh.git synced 2024-09-03 19:45:56 +02:00

Merge branch 'upgrade-testing' into testing

This commit is contained in:
ericgaspar 2020-12-10 21:18:44 +01:00
commit 4ff65d6f37
No known key found for this signature in database
GPG key ID: 574F281483054D44
3 changed files with 36 additions and 2 deletions

View file

@ -6,7 +6,7 @@
"en": "Open source analytics platform for measuring Web statistics",
"fr": "Plateforme d'analyse open source de mesure de statistiques Web"
},
"version": "4.0.5~ynh1",
"version": "4.0.5~ynh2",
"url": "https://matomo.org",
"license": "GPL-3.0-or-later",
"maintainer": {

View file

@ -76,3 +76,19 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
# Send the email to the recipients
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
}
# Execute a command as another user
# usage: ynh_exec_as USER COMMAND [ARG ...]
ynh_exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" "$@"
fi
}

View file

@ -80,8 +80,26 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
# Create a temporary directory
tmpdir="$(mktemp -d)"
# Backup the config file in the temp dir
cp -a "$final_path/config/config.ini.php" "$tmpdir/config.ini.php"
# Remove the app directory securely
ynh_secure_remove --file=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
#Copy the admin saved settings from tmp directory to final path
cp -a "$tmpdir/config.ini.php" "$final_path/config/config.ini.php"
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
pushd "$final_path/console"
ynh_exec_as $app core:update
popd
fi
#=================================================
@ -105,7 +123,7 @@ ynh_system_user_create --username=$app
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
# Create a dedicated php-fpm config
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=medium --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)