diff options
| author | 2019-11-08 23:11:35 +0100 | |
|---|---|---|
| committer | 2019-11-08 23:11:35 +0100 | |
| commit | f1d1d46651140961d6dc9436b3b9c66a2723f896 (patch) | |
| tree | 70633ef58c95e861edbb7365b6afdb4df7a0005a | |
| parent | 6d596e9e54308297d423b23bf65338d62eebc415 (diff) | |
Fix CLI bug regarding an empty user (#2646)
Fix https://github.com/FreshRSS/FreshRSS/issues/2644
| -rw-r--r-- | cli/_cli.php | 2 | ||||
| -rwxr-xr-x | cli/user-info.php | 2 | ||||
| -rw-r--r-- | lib/Minz/ModelPdo.php | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/cli/_cli.php b/cli/_cli.php index dec244bc3..4e1188428 100644 --- a/cli/_cli.php +++ b/cli/_cli.php @@ -37,7 +37,7 @@ function cliInitUser($username) { if (FreshRSS_Context::$user_conf == null) { fail('FreshRSS error: invalid configuration for user: ' . $username . "\n"); } - new Minz_ModelPdo($username); + Minz_Session::_param('currentUser', $username); return $username; } diff --git a/cli/user-info.php b/cli/user-info.php index aa4db7c2f..f56bd9aa5 100755 --- a/cli/user-info.php +++ b/cli/user-info.php @@ -43,7 +43,7 @@ if (array_key_exists('header', $options)) { foreach ($users as $username) { $username = cliInitUser($username); - $catDAO = FreshRSS_Factory::createCategoryDao(); + $catDAO = FreshRSS_Factory::createCategoryDao($username); $feedDAO = FreshRSS_Factory::createFeedDao($username); $entryDAO = FreshRSS_Factory::createEntryDao($username); $tagDAO = FreshRSS_Factory::createTagDao($username); diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index 6eb4881dc..ed88d58d1 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -28,13 +28,13 @@ class Minz_ModelPdo { if ($currentUser === null) { $currentUser = Minz_Session::param('currentUser'); } - if ($currentUser == '') { - throw new Minz_PDOConnectionException('Current user must not be empty!', '', Minz_Exception::ERROR); - } if ($currentPdo != null) { $this->pdo = $currentPdo; return; } + if ($currentUser == '') { + throw new Minz_PDOConnectionException('Current user must not be empty!', '', Minz_Exception::ERROR); + } if (self::$usesSharedPdo && self::$sharedPdo != null && ($currentUser == '' || $currentUser === self::$sharedCurrentUser)) { $this->pdo = self::$sharedPdo; |
