From 9c6682e7edf8cbad828088cbeeef66c7ecefdd9a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 2 Jan 2021 21:20:19 +0100 Subject: 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 --- app/Models/Factory.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'app/Models/Factory.php') diff --git a/app/Models/Factory.php b/app/Models/Factory.php index 69885c205..308ff2864 100644 --- a/app/Models/Factory.php +++ b/app/Models/Factory.php @@ -7,8 +7,7 @@ class FreshRSS_Factory { } public static function createCategoryDao($username = null) { - $conf = Minz_Configuration::get('system'); - switch ($conf->db['type']) { + switch (FreshRSS_Context::$system_conf->db['type']) { case 'sqlite': return new FreshRSS_CategoryDAOSQLite($username); default: @@ -17,8 +16,7 @@ class FreshRSS_Factory { } public static function createFeedDao($username = null) { - $conf = Minz_Configuration::get('system'); - switch ($conf->db['type']) { + switch (FreshRSS_Context::$system_conf->db['type']) { case 'sqlite': return new FreshRSS_FeedDAOSQLite($username); default: @@ -27,8 +25,7 @@ class FreshRSS_Factory { } public static function createEntryDao($username = null) { - $conf = Minz_Configuration::get('system'); - switch ($conf->db['type']) { + switch (FreshRSS_Context::$system_conf->db['type']) { case 'sqlite': return new FreshRSS_EntryDAOSQLite($username); case 'pgsql': @@ -39,8 +36,7 @@ class FreshRSS_Factory { } public static function createTagDao($username = null) { - $conf = Minz_Configuration::get('system'); - switch ($conf->db['type']) { + switch (FreshRSS_Context::$system_conf->db['type']) { case 'sqlite': return new FreshRSS_TagDAOSQLite($username); case 'pgsql': @@ -51,8 +47,7 @@ class FreshRSS_Factory { } public static function createStatsDAO($username = null) { - $conf = Minz_Configuration::get('system'); - switch ($conf->db['type']) { + switch (FreshRSS_Context::$system_conf->db['type']) { case 'sqlite': return new FreshRSS_StatsDAOSQLite($username); case 'pgsql': @@ -63,8 +58,7 @@ class FreshRSS_Factory { } public static function createDatabaseDAO($username = null) { - $conf = Minz_Configuration::get('system'); - switch ($conf->db['type']) { + switch (FreshRSS_Context::$system_conf->db['type']) { case 'sqlite': return new FreshRSS_DatabaseDAOSQLite($username); case 'pgsql': -- cgit v1.2.3