1
0
Fork 0
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:
tituspijean 2021-03-19 19:19:21 +01:00 committed by GitHub
commit 8fe64ae10e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 94 deletions

View file

@ -1,4 +1,4 @@
baseUrl : "https://__DOMAIN__/__PATH__" baseUrl : "https://__DOMAIN____PATH__"
databaseConfiguration : databaseConfiguration :
host : "localhost" host : "localhost"
database : "__USER__" database : "__USER__"
@ -8,6 +8,6 @@ adminUser :
username : "__ADMIN__" username : "__ADMIN__"
password : "__ADMIN_PWD__" password : "__ADMIN_PWD__"
password_confirmation : "__ADMIN_PWD__" password_confirmation : "__ADMIN_PWD__"
email : "__ADMIN_EML__" email : "__ADMIN_MAIL__"
settings : settings :
forum_title : "__FORUM_TITLE__" forum_title : "__TITLE__"

View file

@ -7,7 +7,7 @@
"fr": "Un forum de nouvelle génération, simplement.", "fr": "Un forum de nouvelle génération, simplement.",
"de": "Forum der nächsten Generation leicht gemacht." "de": "Forum der nächsten Generation leicht gemacht."
}, },
"version": "0.1.0.14~ynh2", "version": "0.1.0.14~ynh3",
"url": "http://flarum.org/", "url": "http://flarum.org/",
"license": "MIT", "license": "MIT",
"maintainer": { "maintainer": {
@ -15,7 +15,7 @@
"email": "tituspijean@outlook.com" "email": "tituspijean@outlook.com"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.8.1" "yunohost": ">= 4.1.2"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -26,7 +26,7 @@
"arguments": { "arguments": {
"install" : [ "install" : [
{ {
"name": "domain", "name": "swap",
"type": "display_text", "type": "display_text",
"ask": { "ask": {
"en": "The installation will add a 1 GB swap file if your system has less than 1 GB free RAM.", "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", "name": "domain",
"type": "domain", "type": "domain",
"ask": { "example": "example.com"
"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", "name": "path",
"type": "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", "example": "/flarum",
"default": "/flarum" "default": "/flarum"
}, },
{ {
"name": "admin", "name": "admin",
"type": "user", "type": "user",
"ask": {
"en": "Choose the admin user",
"fr": "Choisissez ladministrateur",
"de": "Wählen einen Administrator"
},
"example": "johndoe" "example": "johndoe"
}, },
{ {
@ -78,11 +63,6 @@
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?",
"de": "Ist es eine öffentliche Applikation ?"
},
"help": { "help": {
"en": "If public, it will be open to all visitors like any forum. If private, only the YunoHost server users can access it.", "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." "fr": "Si public, le forum sera accessible à tous, comme pour tout forum. Si privé, seuls les utilisateurs du serveur YunoHost pourront y accéder."

View file

@ -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=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url 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=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=language --value=$language
ynh_app_setting_set --app=$app --key=project_version --value=$project_version ynh_app_setting_set --app=$app --key=project_version --value=$project_version
ynh_app_setting_set --app=$app --key=core_version --value=$core_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" ynh_exec_warn_less ynh_install_composer --user=$app --phpversion="$phpversion" --workdir="$final_path"
# Set Flarum version # 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 # 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 # 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 # FLARUM POST-INSTALL
#================================================= #=================================================
ynh_script_progression --message="Configuring Flarum..." --weight=2 ynh_script_progression --message="Configuring Flarum..." --weight=2
# Copy the configuration.yml to working directory # Copy and populate configuration.yml to working directory
finalflarumconf="$final_path/configuration.yml" ynh_add_config --template="../conf/configuration.yml" --destination="$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"
# Execute post-installation # Execute post-installation
pushd $final_path pushd $final_path
exec_as $app php$phpversion -d $final_path -d memory_limit=-1 flarum install -f configuration.yml 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 # Delete configuration.yml as it contains sensitive data
ynh_secure_remove $finalflarumconf ynh_secure_remove --file="$final_path/configuration.yml"
popd popd
# Email setup # Email setup

View file

@ -22,7 +22,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin) 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) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language) language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) 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 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 db_name doesn't exist, create it
if [ -z "$db_name" ]; then if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
@ -66,29 +56,10 @@ if [ -z "$final_path" ]; then
fi fi
# Cleaning legacy permissions # Cleaning legacy permissions
is_public=$(ynh_app_setting_get --app=$app --key=is_public) if ynh_legacy_permissions_exists; then
skipped_uris=$(ynh_app_setting_get --app=$app --key=skipped_uris) ynh_legacy_permissions_delete_all
unprotected_uris=$(ynh_app_setting_get --app=$app --key=unprotected_uris)
protected_uris=$(ynh_app_setting_get --app=$app --key=protected_uris)
# Remove is_public if exists ynh_app_setting_delete --app=$app --key=is_public
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 fi
# Remove the v before version number # Remove the v before version number
@ -203,13 +174,13 @@ then
chown -R $app:www-data $final_path chown -R $app:www-data $final_path
# Install Composer and Flarum # 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 # Perform migrations and clear cache
pushd $final_path pushd $final_path
ynh_script_progression --message="Upgrading Flarum and its extensions..." --weight=1 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_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_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 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 migrate
exec_as $app php$phpversion flarum cache:clear exec_as $app php$phpversion flarum cache:clear
popd popd
@ -276,19 +247,6 @@ ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files # Set permissions on app files
chown -R $app:www-data $final_path 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 # RELOAD NGINX
#================================================= #=================================================