A free, self-hostable news aggregator…
Fix CLI bug regarding an empty user (#2646)
Alexandre Alapetitef1d1d4665114
diff --git a/cli/_cli.php b/cli/_cli.phpindex 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.phpindex 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.phpindex 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;