From a58e968ce2b323ec94111217c4f8fc676bbab5a6 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Wed, 1 Nov 2023 04:00:03 +0100 Subject: [PATCH] fix SC2086 linter alerts --- scripts/change_url | 2 +- scripts/install | 10 +++++----- scripts/restore | 10 +++++----- scripts/upgrade | 18 +++++++++--------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 7cf0441..00c31ac 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -25,7 +25,7 @@ ynh_change_url_nginx_config #================================================= ynh_script_progression --message="Upgrading FreshRSS..." --weight=1 -ynh_exec_as $app $install_dir/cli/reconfigure.php --auth_type http_auth --environment production --base_url https://$new_domain$new_path --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_name --db-password $db_pwd --db-base $db_name +ynh_exec_as "$app" "$install_dir/cli/reconfigure.php" --auth_type http_auth --environment production --base_url "https://$new_domain$new_path" --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user "$db_name" --db-password "$db_pwd" --db-base "$db_name" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 0738f1c..137f20c 100755 --- a/scripts/install +++ b/scripts/install @@ -18,7 +18,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1 ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app":www-data "$install_dir" #================================================= # SYSTEM CONFIGURATION @@ -36,8 +36,8 @@ chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" log_path="/var/log/$app" -mkdir -p $log_path -chown $app:www-data $log_path +mkdir -p "$log_path" +chown "$app":www-data "$log_path" # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -48,12 +48,12 @@ ynh_use_logrotate #================================================= ynh_script_progression --message="FreshRSS setup..." --weight=1 -ynh_exec_as $app $install_dir/cli/do-install.php --default_user $admin --auth_type http_auth --environment production --base_url https://$domain$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_name --db-password $db_pwd --db-base $db_name +ynh_exec_as "$app" "$install_dir/cli/do-install.php" --default_user "$admin" --auth_type http_auth --environment production --base_url "https://$domain$path" --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user "$db_name" --db-password "$db_pwd" --db-base "$db_name" for myuser in $(ynh_user_list) do user_token=$(ynh_string_random) - ynh_exec_as $app $install_dir/cli/create-user.php --user $myuser --language $language --token $user_token + ynh_exec_as "$app" "$install_dir/cli/create-user.php" --user "$myuser" --language "$language" --token "$user_token" done #================================================= diff --git a/scripts/restore b/scripts/restore index 7ef4de0..a07ccbf 100644 --- a/scripts/restore +++ b/scripts/restore @@ -18,14 +18,14 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app":www-data "$install_dir" #================================================= # RESTORE THE MYSQL DATABASE #================================================= ynh_script_progression --message="Restoring the MySQL database..." --weight=1 -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql #================================================= # RESTORE SYSTEM CONFIGURATIONS @@ -41,8 +41,8 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/cron.d/$app" log_path="/var/log/$app" -mkdir -p $log_path -chown $app:www-data $log_path +mkdir -p "$log_path" +chown "$app":www-data "$log_path" ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= @@ -52,7 +52,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload +ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 3c85135..3b80d05 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,12 +23,12 @@ upgrade_type=$(ynh_check_app_version_changed) ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 if [ -z "$admin" ]; then - admin=$(ynh_app_setting_get --app=$app --key=admin_user) - if [ -z $admin ]; then + admin=$(ynh_app_setting_get --app="$app" --key=admin_user) + if [ -z "$admin" ]; then ynh_die --message="no admin user found" fi; - ynh_app_setting_delete --app=$app --key=admin_user - ynh_app_setting_set --app=$app --key=admin --value=$admin + ynh_app_setting_delete --app="$app" --key=admin_user + ynh_app_setting_set --app="$app" --key=admin --value="$admin" fi #================================================= @@ -44,7 +44,7 @@ then fi chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app":www-data "$install_dir" #================================================= # REAPPLY SYSTEM CONFIGURATIONS @@ -65,13 +65,13 @@ if [ -f /tmp/FreshRSS.log ]; then ynh_secure_remove --file="/tmp/FreshRSS.log" fi -if [ -f $install_dir/$app.log ]; then +if [ -f "$install_dir/$app.log" ]; then ynh_secure_remove --file="/var/www/$app/$app.log" fi log_path="/var/log/$app" -mkdir -p $log_path -chown $app:www-data "$log_path" +mkdir -p "$log_path" +chown "$app":www-data "$log_path" # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append @@ -83,7 +83,7 @@ ynh_use_logrotate --non-append ynh_script_progression --message="Upgrading FreshRSS..." --weight=1 # reconfigure application with latest parameters -ynh_exec_as $app $install_dir/cli/reconfigure.php --default_user $admin --auth_type http_auth --environment production --base_url https://$domain$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_name --db-password $db_pwd --db-base $db_name +ynh_exec_as "$app" "$install_dir/cli/reconfigure.php" --default_user "$admin" --auth_type http_auth --environment production --base_url "https://$domain$path" --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user "$db_name" --db-password "$db_pwd" --db-base "$db_name" #================================================= # END OF SCRIPT