Skip to content

Commit

Permalink
Fix #15724 - Fix 2FA disabled
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Jan 6, 2020
1 parent 62f068d commit 6c35ea3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
37 changes: 23 additions & 14 deletions libraries/classes/DatabaseInterface.php
Expand Up @@ -1555,13 +1555,33 @@ public function setCollation($collation)
}
}

/**
* 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()
Expand All @@ -1573,18 +1593,7 @@ public function postConnectControl()
*/
$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();
}
}

Expand Down
4 changes: 4 additions & 0 deletions libraries/classes/TwoFactor.php
Expand Up @@ -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();
Expand Down

0 comments on commit 6c35ea3

Please sign in to comment.