diff --git a/libraries/classes/DatabaseInterface.php b/libraries/classes/DatabaseInterface.php index 45d76c8fc6..101d38bd3a 100644 --- a/libraries/classes/DatabaseInterface.php +++ b/libraries/classes/DatabaseInterface.php @@ -1555,13 +1555,33 @@ class DatabaseInterface } } + /** + * This function checks and initialises the phpMyAdmin configuration + * storage state before it is used into session cache. + * + * @return void + */ + public function initRelationParamsCache() + { + if (strlen($GLOBALS['db'])) { + $cfgRelation = $this->relation->getRelationsParam(); + if (empty($cfgRelation['db'])) { + $this->relation->fixPmaTables($GLOBALS['db'], false); + } + } + $cfgRelation = $this->relation->getRelationsParam(); + if (empty($cfgRelation['db'])) { + if ($GLOBALS['dblist']->databases->exists('phpmyadmin')) { + $this->relation->fixPmaTables('phpmyadmin', false); + } + } + } + /** * Function called just after a connection to the MySQL database server has * been established. It sets the connection collation, and determines the * version of MySQL which is running. * - * @param integer $link link type - * * @return void */ public function postConnectControl() @@ -1573,18 +1593,7 @@ class DatabaseInterface */ $GLOBALS['dblist'] = new DatabaseList(); - if (strlen($GLOBALS['db'])) { - $cfgRelation = $this->relation->getRelationsParam(); - if (empty($cfgRelation['db'])) { - $this->relation->fixPmaTables($GLOBALS['db'], false); - } - } - $cfgRelation = $this->relation->getRelationsParam(); - if (empty($cfgRelation['db'])) { - if ($GLOBALS['dblist']->databases->exists('phpmyadmin')) { - $this->relation->fixPmaTables('phpmyadmin', false); - } - } + $this->initRelationParamsCache(); } } diff --git a/libraries/classes/TwoFactor.php b/libraries/classes/TwoFactor.php index 9ac4ee20b5..efdf89b4ce 100644 --- a/libraries/classes/TwoFactor.php +++ b/libraries/classes/TwoFactor.php @@ -51,6 +51,10 @@ class TwoFactor */ public function __construct($user) { + /** @var DatabaseInterface $dbi */ + global $dbi; + $dbi->initRelationParamsCache(); + $this->userPreferences = new UserPreferences(); $this->user = $user; $this->_available = $this->getAvailable();