mirror of
https://github.com/YunoHost-Apps/flarum_ynh.git
synced 2024-09-03 18:36:24 +02:00
Improve extension activation commands
This commit is contained in:
parent
89478f48a0
commit
82e6e95c51
1 changed files with 4 additions and 3 deletions
|
@ -43,9 +43,10 @@ activate_flarum_extension() {
|
|||
sql_command="SELECT \`value\` FROM settings WHERE \`key\` = 'extensions_enabled'"
|
||||
old_extensions_enabled=$(ynh_mysql_execute_as_root "$sql_command" $database | tail -1)
|
||||
|
||||
# Append the extension name at the end of the list
|
||||
addition=",\"${short_extension}\"]"
|
||||
new_extensions_enabled=${old_extensions_enabled::-1}$addition
|
||||
# Use jq to test presence of the extension in the list of enabled extensions
|
||||
# if not, then add it.
|
||||
new_extensions_enabled=$(jq -jrc --arg short_extension 'if (any(index("$short_extension")) | not) then . |= + $short_extension else . end' <<< $old_extensions_enabled)
|
||||
|
||||
# Update activated extensions list
|
||||
sql_command="UPDATE \`settings\` SET \`value\`='$new_extensions_enabled' WHERE \`key\`='extensions_enabled';"
|
||||
ynh_mysql_execute_as_root "$sql_command" $database
|
||||
|
|
Loading…
Reference in a new issue