diff options
| author | 2021-01-02 21:20:19 +0100 | |
|---|---|---|
| committer | 2021-01-02 21:20:19 +0100 | |
| commit | 9c6682e7edf8cbad828088cbeeef66c7ecefdd9a (patch) | |
| tree | c8c8a6ba34d49d22497a14ddaf18ae97d8cd5bb1 /cli/reconfigure.php | |
| parent | 7bc2cc5825547f5b5cf15005fda937e06065b45d (diff) | |
Avoid manual initialisations of system or user configuration (#3070)
* Avoid manual intialisations of system or user configuration
More consistent use of Context
* Simplify FreshRSS_Context::initUser
* Remove a few manual get_user_configuration
* A bit of debugging
* Fix context user init
* Fix install
* Fix concurrency
Concurrent requests could lead to bad race condition
* Fix actualize cron
Fix case when system i initialised several times
Diffstat (limited to 'cli/reconfigure.php')
| -rwxr-xr-x | cli/reconfigure.php | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/cli/reconfigure.php b/cli/reconfigure.php index 45e913d76..7495fc367 100755 --- a/cli/reconfigure.php +++ b/cli/reconfigure.php @@ -37,14 +37,13 @@ if (!validateOptions($argv, array_merge($params, $dBparams))) { fwrite(STDERR, 'Reconfiguring FreshRSS…' . "\n"); -$config = Minz_Configuration::get('system'); foreach ($params as $param) { $param = rtrim($param, ':'); if (isset($options[$param])) { - $config->$param = $options[$param] === false ? true : $options[$param]; + FreshRSS_Context::$system_conf->$param = $options[$param] === false ? true : $options[$param]; } } -$db = $config->db; +$db = FreshRSS_Context::$system_conf->db; foreach ($dBparams as $dBparam) { $dBparam = rtrim($dBparam, ':'); if (isset($options[$dBparam])) { @@ -52,17 +51,19 @@ foreach ($dBparams as $dBparam) { $db[$param] = $options[$dBparam]; } } -$config->db = $db; +FreshRSS_Context::$system_conf->db = $db; -if (!FreshRSS_user_Controller::checkUsername($config->default_user)) { - fail('FreshRSS invalid default username (must be ASCII alphanumeric): ' . $config->default_user); +if (!FreshRSS_user_Controller::checkUsername(FreshRSS_Context::$system_conf->default_user)) { + fail('FreshRSS invalid default username (must be ASCII alphanumeric): ' . + FreshRSS_Context::$system_conf->default_user); } -if (isset($config->auth_type) && !in_array($config->auth_type, array('form', 'http_auth', 'none'))) { +if (isset(FreshRSS_Context::$system_conf->auth_type) && + !in_array(FreshRSS_Context::$system_conf->auth_type, array('form', 'http_auth', 'none'))) { fail('FreshRSS invalid authentication method (auth_type must be one of { form, http_auth, none }: ' - . $config->auth_type); + . FreshRSS_Context::$system_conf->auth_type); } -$config->save(); +FreshRSS_Context::$system_conf->save(); done(); |
