aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Context.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2022-11-15 15:42:26 +0100
committerGravatar GitHub <noreply@github.com> 2022-11-15 15:42:26 +0100
commit42eeb402ad574236902e40d35d630fa15d29a985 (patch)
tree4eeaedaabcb8ef94b11170f76d55916969b2fe9f /app/Models/Context.php
parent07c94061a9607b5d0a1341cc1b349ee094d5115b (diff)
Fix type hints regressions (#4855)
Fix regressions from https://github.com/FreshRSS/FreshRSS/pull/4561 Example: ``` PHP Fatal error: Uncaught TypeError: Argument 1 passed to checkToken() must be an instance of FreshRSS_UserConfiguration, instance of Minz_Configuration given, called in /var/www/FreshRSS/p/api/greader.php on line 1091 and defined in /var/www/FreshRSS/p/api/greader.php:223 Stack trace: #0 /var/www/FreshRSS/p/api/greader.php(1091): checkToken() #1 {main} thrown in /var/www/FreshRSS/p/api/greader.php on line 223 ``` Improvement of https://github.com/FreshRSS/FreshRSS/pull/4110
Diffstat (limited to 'app/Models/Context.php')
-rw-r--r--app/Models/Context.php14
1 files changed, 2 insertions, 12 deletions
diff --git a/app/Models/Context.php b/app/Models/Context.php
index 152ecc4bf..0176e77fa 100644
--- a/app/Models/Context.php
+++ b/app/Models/Context.php
@@ -58,12 +58,7 @@ class FreshRSS_Context {
public static function initSystem($reload = false) {
if ($reload || FreshRSS_Context::$system_conf == null) {
//TODO: Keep in session what we need instead of always reloading from disk
- Minz_Configuration::register('system', DATA_PATH . '/config.php', FRESHRSS_PATH . '/config.default.php');
- /**
- * @var FreshRSS_SystemConfiguration $system_conf
- */
- $system_conf = Minz_Configuration::get('system');
- FreshRSS_Context::$system_conf = $system_conf;
+ FreshRSS_Context::$system_conf = FreshRSS_SystemConfiguration::init(DATA_PATH . '/config.php', FRESHRSS_PATH . '/config.default.php');
// Register the configuration setter for the system configuration
$configurationSetter = new FreshRSS_ConfigurationSetter();
FreshRSS_Context::$system_conf->_configurationSetter($configurationSetter);
@@ -88,17 +83,12 @@ class FreshRSS_Context {
(!$userMustExist || FreshRSS_user_Controller::userExists($username))) {
try {
//TODO: Keep in session what we need instead of always reloading from disk
- Minz_Configuration::register('user',
+ FreshRSS_Context::$user_conf = FreshRSS_UserConfiguration::init(
USERS_PATH . '/' . $username . '/config.php',
FRESHRSS_PATH . '/config-user.default.php',
FreshRSS_Context::$system_conf->configurationSetter());
Minz_Session::_param('currentUser', $username);
- /**
- * @var FreshRSS_UserConfiguration $user_conf
- */
- $user_conf = Minz_Configuration::get('user');
- FreshRSS_Context::$user_conf = $user_conf;
} catch (Exception $ex) {
Minz_Log::warning($ex->getMessage(), USERS_PATH . '/_/' . LOG_FILENAME);
}