mirror of
https://github.com/YunoHost-Apps/flarum_ynh.git
synced 2024-09-03 18:36:24 +02:00
Merge branch 'testing' into upgrade
This commit is contained in:
commit
d694b94708
4 changed files with 21 additions and 9 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
[![Install Hubzilla with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=flarum)
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/flarum.svg)](https://dash.yunohost.org/appci/app/flarum) [![Flarum version](https://img.shields.io/badge/flarum-0.1.0--beta.7.1-green.svg)](https://github.com/flarum/core/releases/tag/v0.1.0-beta.7.1)
|
||||
[![Integration level](https://ci-apps.yunohost.org/ci/logs/flarum%20(Community).svg)](https://dash.yunohost.org/appci/app/flarum) [![Flarum version](https://img.shields.io/badge/flarum-0.1.0--beta.7.1-green.svg)](https://github.com/flarum/core/releases/tag/v0.1.0-beta.7.1)
|
||||
|
||||
[Flarum](http://flarum.org/), an open-source forum software, packaged for [YunoHost](https://yunohost.org/), a self-hosting server operating server.
|
||||
|
||||
|
|
|
@ -26,10 +26,11 @@ exec_composer() {
|
|||
# Do not run composer as root
|
||||
if [ $AS_USER = "root" ] ; then ynh_die "Do not run composer as root" ; fi
|
||||
pushd "${WORKDIR}"
|
||||
exec_as "$AS_USER" COMPOSER_HOME="${WORKDIR}/.composer" \
|
||||
ynh_exec_warn_less \
|
||||
"exec_as "$AS_USER" COMPOSER_HOME="${WORKDIR}/.composer" \
|
||||
php -d memory_limit=-1 \
|
||||
"${WORKDIR}/composer.phar" $@ \
|
||||
--quiet --no-interaction
|
||||
--no-interaction"
|
||||
popd
|
||||
}
|
||||
|
||||
|
@ -44,8 +45,8 @@ init_composer() {
|
|||
|
||||
# install composer
|
||||
curl -sS https://getcomposer.org/installer \
|
||||
| COMPOSER_HOME="${WORKDIR}/.composer" \
|
||||
php -- --quiet --install-dir="$WORKDIR" \
|
||||
| ynh_exec_warn_less \
|
||||
"COMPOSER_HOME="${WORKDIR}/.composer" php -- --install-dir="$WORKDIR"" \
|
||||
|| ynh_die "Unable to install Composer"
|
||||
chmod +x "${WORKDIR}/composer.phar"
|
||||
# update dependencies to create composer.lock
|
||||
|
|
|
@ -101,6 +101,7 @@ sudo chown -R $app:www-data $tmp
|
|||
sudo chmod -R 0775 $tmp
|
||||
|
||||
# Install Flarum
|
||||
ynh_print_info "Composer is installing Flarum and its dependencies. It may take a while..."
|
||||
# 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
|
||||
|
@ -111,6 +112,7 @@ sudo cp -Rf $tmp/* $final_path
|
|||
sudo chown -R $app:www-data $final_path
|
||||
sudo chmod -R 0775 $final_path
|
||||
ynh_secure_remove $tmp
|
||||
ynh_print_info " ... done!"
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
|
@ -175,6 +177,7 @@ systemctl reload nginx
|
|||
# FLARUM POST-INSTALL
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Configuring Flarum..."
|
||||
# Copy the configuration.yml to working directory
|
||||
finalflarumconf="$final_path/configuration.yml"
|
||||
cp ../conf/configuration.yml $finalflarumconf
|
||||
|
@ -206,6 +209,7 @@ sql_command="REPLACE INTO \`settings\` (\`key\`, \`value\`) VALUES
|
|||
('mail_host', 'localhost'),
|
||||
('mail_port', '587');"
|
||||
ynh_mysql_execute_as_root "$sql_command" $db_name
|
||||
ynh_print_info " ... done!"
|
||||
|
||||
# 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"
|
||||
|
@ -213,6 +217,7 @@ install_and_activate_extension $app $final_path $db_name "tituspijean/flarum-ext
|
|||
ssowatdomain=$(</etc/yunohost/current_host)
|
||||
sql_command="INSERT INTO \`settings\` (\`key\`, \`value\`) VALUES ('tituspijean-auth-ssowat.domain', '$ssowatdomain'), ('tituspijean-auth-ssowat.onlyUse', '0');"
|
||||
ynh_mysql_execute_as_root "$sql_command" $db_name
|
||||
ynh_print_info "SSOwat extension has been installed."
|
||||
|
||||
# Install, activate and set language extensions
|
||||
case $language in
|
||||
|
@ -220,21 +225,24 @@ case $language in
|
|||
install_and_activate_extension $app $final_path $db_name "milescellar/flarum-ext-french" "milescellar-french"
|
||||
sql_command="UPDATE \`settings\` SET \`value\` = 'fr' WHERE \`settings\`.\`key\` = 'default_locale'"
|
||||
ynh_mysql_execute_as_root "$sql_command" $db_name
|
||||
ynh_print_info "French language has been installed."
|
||||
;;
|
||||
de)
|
||||
install_and_activate_extension $app $final_path $db_name "cbmainz/flarum-de" "cbmainz-de"
|
||||
sql_command="UPDATE \`settings\` SET \`value\` = 'de' WHERE \`settings\`.\`key\` = 'default_locale'"
|
||||
ynh_mysql_execute_as_root "$sql_command" $db_name
|
||||
ynh_print_info "German language has been installed."
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $bazaar_extension -eq 1 ]; then
|
||||
exec_composer $app $final_path "require flagrow/bazaar --ansi"
|
||||
ynh_print_info "Bazaar extension has been installed."
|
||||
fi
|
||||
|
||||
# Send login credentials to admin
|
||||
app_message="User : $admin, password : $admin_pwd
|
||||
Change your password!
|
||||
Your forum is accessible at https://$domain$path_url"
|
||||
>&2 echo $app_message
|
||||
ynh_send_readme_to_admin "$app_message" "$admin"
|
||||
ynh_print_warn "$app_message"
|
||||
|
|
|
@ -124,9 +124,10 @@ if [[ $(dpkg --compare-versions $old_flarum_version lt $flarum_version && echo t
|
|||
pushd $final_path
|
||||
exec_as $app php flarum cache:clear
|
||||
popd
|
||||
ynh_print_info "Flarum has been updated to version $flarum_version."
|
||||
upgraded_flarum=true
|
||||
else
|
||||
echo "Flarum does not need to be updated."
|
||||
ynh_print_info "Flarum does not need updating."
|
||||
upgraded_flarum=false
|
||||
fi
|
||||
|
||||
|
@ -138,14 +139,16 @@ if [[ $(dpkg --compare-versions $old_ssowat_ext_ver lt $ssowat_ext_ver && echo t
|
|||
ssowatdomain=$(</etc/yunohost/current_host)
|
||||
sql_command="INSERT IGNORE INTO \`settings\` (\`key\`, \`value\`) VALUES ('tituspijean-auth-ssowat.domain', '$ssowatdomain'), ('tituspijean-auth-ssowat.onlyUse', '0');"
|
||||
ynh_mysql_execute_as_root "$sql_command" $db_name
|
||||
ynh_print_info "SSOwat extension has been updated and configured."
|
||||
upgraded_ssowat=true
|
||||
else
|
||||
echo "SSOwat extension does not need to be updated."
|
||||
upgraded_ssowat=false
|
||||
ynh_print_info "SSOwat extension does not need updating."
|
||||
upgraded_ssowat=false
|
||||
fi
|
||||
|
||||
if [ $bazaar_extension -eq 1 ]; then
|
||||
install_and_activate_extension $app $final_path $db_name "flagrow/bazaar" "flagrow-bazaar"
|
||||
ynh_print_info "Bazaar extension has been installed."
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue