diff options
| author | 2019-11-06 21:54:13 +0100 | |
|---|---|---|
| committer | 2019-11-06 21:54:13 +0100 | |
| commit | 91cb165829badde07c42a002215cf52779d891b6 (patch) | |
| tree | b8ee6e04e32dcf6c6fc25b7b0b9fe2952d2991ba /lib | |
| parent | 3aa66f317b496ccd9a2df914bbc747c52081a7ad (diff) | |
| parent | 6d596e9e54308297d423b23bf65338d62eebc415 (diff) | |
Merge pull request #2633 from FreshRSS/dev1.15.1
FreshRSS 1.15.1
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Minz/ModelPdo.php | 4 | ||||
| -rw-r--r-- | lib/lib_install.php | 21 |
2 files changed, 17 insertions, 8 deletions
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) { diff --git a/lib/lib_install.php b/lib/lib_install.php index ed361eb39..5ea1b4d2b 100644 --- a/lib/lib_install.php +++ b/lib/lib_install.php @@ -78,21 +78,28 @@ function generateSalt() { return sha1(uniqid(mt_rand(), true).implode('', stat(__FILE__))); } -function checkDb() { +function initDb() { $conf = FreshRSS_Context::$system_conf; $db = $conf->db; if (empty($db['pdo_options'])) { $db['pdo_options'] = []; } $db['pdo_options'][PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; - $dbBase = isset($db['base']) ? $db['base'] : ''; + $conf->db = $db; //TODO: Remove this Minz limitation "Indirect modification of overloaded property" - $db['base'] = ''; //First connection without database name to create the database - Minz_ModelPdo::$usesSharedPdo = false; - $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); - $databaseDAO->create(); + if ($db['type'] !== 'sqlite') { + Minz_ModelPdo::$usesSharedPdo = false; + $dbBase = isset($db['base']) ? $db['base'] : ''; + $db['base'] = ''; + $conf->db = $db; + //First connection without database name to create the database + $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); + $db['base'] = $dbBase; + $conf->db = $db; + $databaseDAO->create(); + } - $db['base'] = $dbBase; //New connection with the database name + //New connection with the database name $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); Minz_ModelPdo::$usesSharedPdo = true; return $databaseDAO->testConnection(); |
