aboutsummaryrefslogtreecommitdiff
path: root/app/install.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2021-01-02 21:20:19 +0100
committerGravatar GitHub <noreply@github.com> 2021-01-02 21:20:19 +0100
commit9c6682e7edf8cbad828088cbeeef66c7ecefdd9a (patch)
treec8c8a6ba34d49d22497a14ddaf18ae97d8cd5bb1 /app/install.php
parent7bc2cc5825547f5b5cf15005fda937e06065b45d (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 'app/install.php')
-rw-r--r--app/install.php44
1 files changed, 17 insertions, 27 deletions
diff --git a/app/install.php b/app/install.php
index 418c72eba..bb7d9de9d 100644
--- a/app/install.php
+++ b/app/install.php
@@ -69,29 +69,21 @@ function saveStep1() {
// with values from the previous installation
// First, we try to get previous configurations
- Minz_Configuration::register('system',
- join_path(DATA_PATH, 'config.php'),
- join_path(FRESHRSS_PATH, 'config.default.php'));
- $system_conf = Minz_Configuration::get('system');
-
- $current_user = $system_conf->default_user;
- Minz_Configuration::register('user',
- join_path(USERS_PATH, $current_user, 'config.php'),
- join_path(FRESHRSS_PATH, 'config-user.default.php'));
- $user_conf = Minz_Configuration::get('user');
+ FreshRSS_Context::initSystem();
+ FreshRSS_Context::initUser(FreshRSS_Context::$system_conf->default_user);
// Then, we set $_SESSION vars
Minz_Session::_params([
- 'title' => $system_conf->title,
- 'auth_type' => $system_conf->auth_type,
- 'default_user' => $current_user,
- 'passwordHash' => $user_conf->passwordHash,
- 'bd_type' => $system_conf->db['type'],
- 'bd_host' => $system_conf->db['host'],
- 'bd_user' => $system_conf->db['user'],
- 'bd_password' => $system_conf->db['password'],
- 'bd_base' => $system_conf->db['base'],
- 'bd_prefix' => $system_conf->db['prefix'],
+ 'title' => FreshRSS_Context::$system_conf->title,
+ 'auth_type' => FreshRSS_Context::$system_conf->auth_type,
+ 'default_user' => Minz_Session::param('currentUser'),
+ 'passwordHash' => FreshRSS_Context::$user_conf->passwordHash,
+ 'bd_type' => FreshRSS_Context::$system_conf->db['type'],
+ 'bd_host' => FreshRSS_Context::$system_conf->db['host'],
+ 'bd_user' => FreshRSS_Context::$system_conf->db['user'],
+ 'bd_password' => FreshRSS_Context::$system_conf->db['password'],
+ 'bd_base' => FreshRSS_Context::$system_conf->db['base'],
+ 'bd_prefix' => FreshRSS_Context::$system_conf->db['prefix'],
'bd_error' => false,
]);
@@ -159,8 +151,7 @@ function saveStep2() {
opcache_reset();
}
- Minz_Configuration::register('system', DATA_PATH . '/config.php', FRESHRSS_PATH . '/config.default.php');
- FreshRSS_Context::$system_conf = Minz_Configuration::get('system');
+ FreshRSS_Context::initSystem();
$ok = false;
try {
@@ -211,13 +202,9 @@ function saveStep3() {
return false;
}
- Minz_Configuration::register('system', DATA_PATH . '/config.php', FRESHRSS_PATH . '/config.default.php');
- FreshRSS_Context::$system_conf = Minz_Configuration::get('system');
+ FreshRSS_Context::initSystem();
Minz_Translate::init(Minz_Session::param('language'));
- FreshRSS_Context::$system_conf->default_user = Minz_Session::param('default_user');
- FreshRSS_Context::$system_conf->save();
-
// Create default user files but first, we delete previous data to
// avoid access right problems.
recursive_unlink(USERS_PATH . '/' . Minz_Session::param('default_user'));
@@ -242,6 +229,9 @@ function saveStep3() {
return false;
}
+ FreshRSS_Context::$system_conf->default_user = Minz_Session::param('default_user');
+ FreshRSS_Context::$system_conf->save();
+
header('Location: index.php?step=4');
}
}