From 22030155f8fd5cab102ddd897a914cf1a0ffd183 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 6 Nov 2019 15:16:00 +0100 Subject: Fix database autocreate at install (#2635) * Fix database autocreate at install Several bugs prevented the auto-creation of the database in Web and CLI installs. Fix https://github.com/YunoHost-Apps/freshrss_ynh/issues/84#issuecomment-549818408 * initDb https://github.com/FreshRSS/FreshRSS/pull/2635#discussion_r343107795 --- lib/Minz/ModelPdo.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/Minz/ModelPdo.php') diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index 69785c253..6eb4881dc 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -28,6 +28,9 @@ 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; @@ -84,7 +87,6 @@ class Minz_ModelPdo { 'Invalid database type!', $db['user'], Minz_Exception::ERROR ); - break; } self::$sharedPdo = $this->pdo; } catch (Exception $e) { -- cgit v1.2.3