openrat-cms

OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs | README

commit fbeb47c4ff445e09130ee3a8abfaea0331e10687
parent 139a2c5385ab6bb0c1e83db5ce8308723f29df28
Author: Jan Dankert <develop@jandankert.de>
Date:   Thu, 19 Nov 2020 23:25:29 +0100

Fix: Calculation of enabled databases was totally broken.

Diffstat:
Mmodules/cms/action/LoginAction.class.php | 2+-
Mmodules/cms/action/login/LoginLoginAction.class.php | 24+++---------------------
2 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/modules/cms/action/LoginAction.class.php b/modules/cms/action/LoginAction.class.php @@ -68,7 +68,7 @@ class LoginAction extends BaseAction protected function getAllEnabledDatabases() { return array_filter( Configuration::subset('database')->subsets(), function($dbConfig) { - $dbConfig->is('enabled',true); + return $dbConfig->is('enabled',true); }); } diff --git a/modules/cms/action/login/LoginLoginAction.class.php b/modules/cms/action/login/LoginLoginAction.class.php @@ -43,27 +43,9 @@ class LoginLoginAction extends LoginAction implements Method { $this->setTemplateVar('enableOpenIdConnect' ,(boolean)$oidcList ); $this->setTemplateVar('provider' ,$oidcList ); - $databases = Configuration::subset('database')->subsets(); - - // Filter all enabled databases - $databases = array_filter( $databases, function($dbConfig) { - $dbConfig->is('enabled',true); - }); - - $dbids = []; - foreach( $databases as $dbid => $dbconf ) - { - // Getting the first not-null information about the connection. - $dbids[ $dbid ] = array_filter( array( - $dbconf->get('description'), - $dbconf->get('name'), - $dbconf->get('host'), - $dbconf->get('driver'), - $dbid))[0]; - } - - - if ( empty($dbids) ) + $dbids = $this->getSelectableDatabases(); + + if ( ! $dbids ) $this->addWarningFor( null,Messages::NO_DATABASE_CONFIGURATION ); $this->setTemplateVar( 'dbids',$dbids );