Beispiel #1
0
 /**
  * Returns singleton database handler.
  * 
  * @return \LMSDBInterface
  */
 public static function getInstance()
 {
     if (self::$db === null) {
         $_DBTYPE = LMSConfig::getIniConfig()->getSection('database')->getVariable('type')->getValue();
         $_DBHOST = LMSConfig::getIniConfig()->getSection('database')->getVariable('host')->getValue();
         $_DBUSER = LMSConfig::getIniConfig()->getSection('database')->getVariable('user')->getValue();
         $_DBPASS = LMSConfig::getIniConfig()->getSection('database')->getVariable('password')->getValue();
         $_DBNAME = LMSConfig::getIniConfig()->getSection('database')->getVariable('database')->getValue();
         $_DBDEBUG = false;
         if (LMSConfig::getIniConfig()->getSection('database')->hasVariable('debug')) {
             $_DBDEBUG = ConfigHelper::checkValue(LMSConfig::getIniConfig()->getSection('database')->getVariable('debug')->getValue());
         }
         self::$db = self::getDB($_DBTYPE, $_DBHOST, $_DBUSER, $_DBPASS, $_DBNAME, $_DBDEBUG);
     }
     return self::$db;
 }