1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/flarum_ynh.git synced 2024-09-03 18:36:24 +02:00

[enh] Handle core and ssowat extension version numbers

Fixes #94
Closes #67
This commit is contained in:
tituspijean 2018-09-03 19:53:07 +02:00
parent ed3c73348b
commit 6523a2d31d
3 changed files with 14 additions and 8 deletions

View file

@ -1,6 +1,6 @@
# Version numbers
flarum_version="0.1.0-beta.7"
ssowat_ext_ver="*@dev"
flarum_version="0.1.0-beta.7.1"
ssowat_ext_ver="0.5"
# Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...]
@ -69,7 +69,7 @@ install_and_activate_extension() {
local new_extensions_enabled
# Install extension
exec_composer $AS_USER $WORKDIR "require $EXTENSION --ansi -d $WORKDIR"
exec_composer $AS_USER $WORKDIR "require $EXTENSION -n --ansi -d $WORKDIR"
# Retrieve current extensions
sql_command="SELECT \`value\` FROM settings WHERE \`key\` = 'extensions_enabled'"

View file

@ -101,7 +101,10 @@ sudo chown -R $app:www-data $tmp
sudo chmod -R 0775 $tmp
# Install Flarum
exec_composer $app $final_path "create-project flarum/flarum $tmp $flarum_version --stability=beta --ansi -d $tmp"
# First, create the project with core and all basic extensions
exec_composer $app $final_path "create-project flarum/flarum $tmp --stability=beta --ansi -d $tmp"
# Let's fix the core version by explicitely requiring it
exec_composer $app $final_path "require flarum/core:$flarum_version -n --ansi -d $tmp"
# Copy Flarum to working directory and clean temp directory
sudo cp -Rf $tmp/* $final_path
@ -204,7 +207,7 @@ sql_command="REPLACE INTO \`settings\` (\`key\`, \`value\`) VALUES
('mail_port', '587');"
ynh_mysql_execute_as_root "$sql_command" $db_name
# Install and active the SSOwat auth extension
# Install and activate the SSOwat auth extension
install_and_activate_extension $app $final_path $db_name "tituspijean/flarum-ext-auth-ssowat:$ssowat_ext_ver" "tituspijean-auth-ssowat"
# Configure SSOwat auth extension
ssowatdomain=$(</etc/yunohost/current_host)

View file

@ -110,9 +110,12 @@ fi
# FLARUM UPGRADE
#=================================================
if [[ $old_flarum_version -ne $flarum_version ]]; then
# Downward compatibility: remove the v before version number
if [[ $old_flarum_version == "v*" ]] then $old_flarum_version = ${old_flarum_version:1}; fi
# Check if upgrade of Flarum core is needed
if [[ dpkg --compare-version $old_flarum_version lt $flarum_version ]]; then
# Upgrade Flarum
exec_composer $app $final_path "update --ansi"
exec_composer $app $final_path "require -n flarum/core:'$flarum_version'"
pushd $final_path
exec_as $app php flarum cache:clear
popd
@ -120,7 +123,7 @@ else
echo "Flarum doesn't need any update, let's check the extension."
fi
# Update SSOwat extension
# Install and activate the SSOwat auth extension
install_and_activate_extension $app $final_path $db_name "tituspijean/flarum-ext-auth-ssowat:$ssowat_ext_ver" "tituspijean-auth-ssowat"
# Configure SSOwat auth extension
ssowatdomain=$(</etc/yunohost/current_host)