aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Factory.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/Models/Factory.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/Models/Factory.php')
-rw-r--r--app/Models/Factory.php18
1 files changed, 6 insertions, 12 deletions
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':