mirror of
https://github.com/YunoHost-Apps/flarum_ynh.git
synced 2024-09-03 18:36:24 +02:00
Merge pull request #161 from YunoHost-Apps/fix-linter-warnings
Fix linter warnings
This commit is contained in:
commit
8fe64ae10e
4 changed files with 20 additions and 94 deletions
|
@ -1,4 +1,4 @@
|
|||
baseUrl : "https://__DOMAIN__/__PATH__"
|
||||
baseUrl : "https://__DOMAIN____PATH__"
|
||||
databaseConfiguration :
|
||||
host : "localhost"
|
||||
database : "__USER__"
|
||||
|
@ -8,6 +8,6 @@ adminUser :
|
|||
username : "__ADMIN__"
|
||||
password : "__ADMIN_PWD__"
|
||||
password_confirmation : "__ADMIN_PWD__"
|
||||
email : "__ADMIN_EML__"
|
||||
email : "__ADMIN_MAIL__"
|
||||
settings :
|
||||
forum_title : "__FORUM_TITLE__"
|
||||
forum_title : "__TITLE__"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"fr": "Un forum de nouvelle génération, simplement.",
|
||||
"de": "Forum der nächsten Generation leicht gemacht."
|
||||
},
|
||||
"version": "0.1.0.14~ynh2",
|
||||
"version": "0.1.0.14~ynh3",
|
||||
"url": "http://flarum.org/",
|
||||
"license": "MIT",
|
||||
"maintainer": {
|
||||
|
@ -15,7 +15,7 @@
|
|||
"email": "tituspijean@outlook.com"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.8.1"
|
||||
"yunohost": ">= 4.1.2"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
|
@ -26,7 +26,7 @@
|
|||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"name": "swap",
|
||||
"type": "display_text",
|
||||
"ask": {
|
||||
"en": "The installation will add a 1 GB swap file if your system has less than 1 GB free RAM.",
|
||||
|
@ -36,32 +36,17 @@
|
|||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain name for Flarum",
|
||||
"fr": "Choisissez un nom de domaine pour Flarum",
|
||||
"de": "Wählen einen Domain-Namen für Flarum"
|
||||
},
|
||||
"example": "example.com"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path for Flarum",
|
||||
"fr": "Choisissez un chemin pour Flarum",
|
||||
"de": "Wählen einen Pfad für Flarum"
|
||||
},
|
||||
"example": "/flarum",
|
||||
"default": "/flarum"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Choose the admin user",
|
||||
"fr": "Choisissez l’administrateur",
|
||||
"de": "Wählen einen Administrator"
|
||||
},
|
||||
"example": "johndoe"
|
||||
},
|
||||
{
|
||||
|
@ -78,11 +63,6 @@
|
|||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Is it a public application?",
|
||||
"fr": "Est-ce une application publique ?",
|
||||
"de": "Ist es eine öffentliche Applikation ?"
|
||||
},
|
||||
"help": {
|
||||
"en": "If public, it will be open to all visitors like any forum. If private, only the YunoHost server users can access it.",
|
||||
"fr": "Si public, le forum sera accessible à tous, comme pour tout forum. Si privé, seuls les utilisateurs du serveur YunoHost pourront y accéder."
|
||||
|
|
|
@ -58,7 +58,6 @@ ynh_script_progression --message="Storing installation settings..."
|
|||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||
ynh_app_setting_set --app=$app --key=project_version --value=$project_version
|
||||
ynh_app_setting_set --app=$app --key=core_version --value=$core_version
|
||||
|
@ -136,38 +135,27 @@ ynh_script_progression --message="Installing composer dependencies..." --weight=
|
|||
ynh_exec_warn_less ynh_install_composer --user=$app --phpversion="$phpversion" --workdir="$final_path"
|
||||
|
||||
# Set Flarum version
|
||||
ynh_composer_exec --user=$app --phpversion=$phpversion --workdir=$final_path --commands="require flarum/core:$core_version --prefer-lowest --no-update"
|
||||
ynh_exec_warn_less ynh_composer_exec --user=$app --phpversion=$phpversion --workdir=$final_path --commands=\"require flarum/core:$core_version --prefer-lowest --no-update\"
|
||||
|
||||
# Require SSOwat extension
|
||||
ynh_composer_exec --user=$app --phpversion=$phpversion --workdir=$final_path --commands="require tituspijean/flarum-ext-auth-ssowat:$ssowat_version --no-update"
|
||||
ynh_exec_warn_less ynh_composer_exec --user=$app --phpversion=$phpversion --workdir=$final_path --commands=\"require tituspijean/flarum-ext-auth-ssowat:$ssowat_version --no-update\"
|
||||
|
||||
# Update and download dependencies
|
||||
ynh_composer_exec --user=$app --phpversion=$phpversion --workdir=$final_path --commands="update"
|
||||
ynh_exec_warn_less ynh_composer_exec --user=$app --phpversion=$phpversion --workdir=$final_path --commands=\"update\"
|
||||
|
||||
#=================================================
|
||||
# FLARUM POST-INSTALL
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring Flarum..." --weight=2
|
||||
|
||||
# Copy the configuration.yml to working directory
|
||||
finalflarumconf="$final_path/configuration.yml"
|
||||
cp ../conf/configuration.yml $finalflarumconf
|
||||
|
||||
# Populate configuration.yml
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$finalflarumconf"
|
||||
ynh_replace_string --match_string="/__PATH__" --replace_string="$path_url" --target_file="$finalflarumconf"
|
||||
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$finalflarumconf"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$finalflarumconf"
|
||||
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$finalflarumconf"
|
||||
ynh_replace_string --match_string="__ADMIN_PWD__" --replace_string="$admin_pwd" --target_file="$finalflarumconf"
|
||||
ynh_replace_string --match_string="__ADMIN_EML__" --replace_string="$admin_mail" --target_file="$finalflarumconf"
|
||||
ynh_replace_string --match_string="__FORUM_TITLE__" --replace_string="$title" --target_file="$finalflarumconf"
|
||||
# Copy and populate configuration.yml to working directory
|
||||
ynh_add_config --template="../conf/configuration.yml" --destination="$final_path/configuration.yml"
|
||||
|
||||
# Execute post-installation
|
||||
pushd $final_path
|
||||
exec_as $app php$phpversion -d $final_path -d memory_limit=-1 flarum install -f configuration.yml
|
||||
# Delete configuration.yml as it contains sensitive data
|
||||
ynh_secure_remove $finalflarumconf
|
||||
ynh_secure_remove --file="$final_path/configuration.yml"
|
||||
popd
|
||||
|
||||
# Email setup
|
||||
|
|
|
@ -22,7 +22,6 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
@ -44,15 +43,6 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
# Fix is_public as a boolean value
|
||||
if [ "$is_public" = "Yes" ]; then
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=1
|
||||
is_public=1
|
||||
elif [ "$is_public" = "No" ]; then
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=0
|
||||
is_public=0
|
||||
fi
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
|
@ -66,31 +56,12 @@ if [ -z "$final_path" ]; then
|
|||
fi
|
||||
|
||||
# Cleaning legacy permissions
|
||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||
skipped_uris=$(ynh_app_setting_get --app=$app --key=skipped_uris)
|
||||
unprotected_uris=$(ynh_app_setting_get --app=$app --key=unprotected_uris)
|
||||
protected_uris=$(ynh_app_setting_get --app=$app --key=protected_uris)
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
# Remove is_public if exists
|
||||
if [ ! -z "$is_public" ]; then
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
# Remove skipped_uris if exists
|
||||
if [ ! -z "$skipped_uris" ]; then
|
||||
ynh_app_setting_delete --app=$app --key=skipped_uris
|
||||
fi
|
||||
|
||||
# Remove unprotected_uris if exists
|
||||
if [ ! -z "$unprotected_uris" ]; then
|
||||
ynh_app_setting_delete --app=$app --key=unprotected_uris
|
||||
fi
|
||||
|
||||
# Remove protected_uris if exists
|
||||
if [ ! -z "$protected_uris" ]; then
|
||||
ynh_app_setting_delete --app=$app --key=protected_uris
|
||||
fi
|
||||
|
||||
# Remove the v before version number
|
||||
if [[ $old_project_version == "v*" ]]; then $old_project_version = ${old_project_version:1}; fi
|
||||
|
||||
|
@ -203,13 +174,13 @@ then
|
|||
chown -R $app:www-data $final_path
|
||||
|
||||
# Install Composer and Flarum
|
||||
ynh_install_composer --user=$app --phpversion=$phpversion --workdir=$final_path
|
||||
ynh_exec_warn_less ynh_install_composer --user=$app --phpversion=$phpversion --workdir=$final_path
|
||||
|
||||
# Perform migrations and clear cache
|
||||
pushd $final_path
|
||||
ynh_script_progression --message="Upgrading Flarum and its extensions..." --weight=1
|
||||
ynh_composer_exec --user=$app --phpversion=$phpversion --workdir=$final_path --commands="require tituspijean/flarum-ext-auth-ssowat:$ssowat_version --no-update"
|
||||
ynh_composer_exec --user=$app --phpversion=$phpversion --workdir=$final_path --commands="require flarum/core:$core_version --prefer-dist --update-no-dev -a --update-with-all-dependencies"
|
||||
ynh_exec_warn_less ynh_composer_exec --user=$app --phpversion=$phpversion --workdir=$final_path --commands=\"require tituspijean/flarum-ext-auth-ssowat:$ssowat_version --no-update\"
|
||||
ynh_exec_warn_less ynh_composer_exec --user=$app --phpversion=$phpversion --workdir=$final_path --commands=\"require flarum/core:$core_version --prefer-dist --update-no-dev -a --update-with-all-dependencies\"
|
||||
exec_as $app php$phpversion flarum migrate
|
||||
exec_as $app php$phpversion flarum cache:clear
|
||||
popd
|
||||
|
@ -276,19 +247,6 @@ ynh_script_progression --message="Securing files and directories..."
|
|||
# Set permissions on app files
|
||||
chown -R $app:www-data $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission "main" --add "visitors"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue