diff --git a/conf/local-sample.config.php b/conf/local-sample.config.php index ef4a0f7..be4e5a4 100644 --- a/conf/local-sample.config.php +++ b/conf/local-sample.config.php @@ -32,7 +32,7 @@ return [ // **************************************************************** 'config' => [ - 'php_path' => '/usr/bin/php' + 'php_path' => '/usr/bin/php', 'admin_email' => '__EMAIL__', 'sitename' => 'Friendica Social Network', 'register_policy' => \Friendica\Module\Register::OPEN, @@ -40,7 +40,7 @@ return [ ], 'system' => [ 'url' => 'https://__DOMAIN__', - 'basepath' => '__INSTALL_DIR__' + 'basepath' => '__INSTALL_DIR__', 'default_timezone' => '__TIMEZONE__', 'language' => '__LANGUAGE__', ], diff --git a/scripts/install b/scripts/install index c270c7b..bc07915 100644 --- a/scripts/install +++ b/scripts/install @@ -38,6 +38,8 @@ chmod -R 775 "$install_dir/view/smarty3" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" +ynh_add_config --template="local-sample.config.php" --destination="$install_dir/config/local.config.php" + #================================================= # SYSTEM CONFIGURATION #================================================= @@ -79,7 +81,7 @@ pushd "$install_dir" # Install application ynh_exec_as "$app" "php$phpversion" bin/console.php autoinstall\ --dbhost "localhost" --dbdata "$db_name" --dbuser "$db_user" --dbpass "$db_pwd"\ - --admin "$email" --tz "$timezone" --lang "$language" --url "https://$domain$path" + --admin "$email" --tz "$timezone" --lang "$language" --url "https://$domain" # Enable LDAP Auth addon ynh_exec_as "$app" "php$phpversion" bin/console.php addon enable ldapauth diff --git a/scripts/upgrade b/scripts/upgrade index d5e7081..0ff2f28 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -58,6 +58,16 @@ chmod 644 "/etc/cron.d/$app" # Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." --weight=1 + +# fix the url if necessary (there should be no trailing slash) +if [ -f "$install_dir/config/local.config.php" ] && ! grep -q -e "'url' => 'https://$domain'," "$install_dir/config/local.config.php"; then + ynh_replace_string --match_string="'url' => 'https://.*'," --replace_string="'url' => 'https://$domain'," --target_file="$install_dir/config/local.config.php" +fi + #================================================= # STORE THE CONFIG FILE CHECKSUM #=================================================