Fix #15724 - Fix 2FA disabled

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2020-01-02 18:15:47 +01:00
parent 62f068d048
commit 6c35ea3be7
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
2 changed files with 27 additions and 14 deletions

View File

@ -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();
}
}

View File

@ -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();