/** * DB Setup * @param $id * @throws core_exception */ function configure_database($id) { if ($id) { if (is_array($id)) { $cfg = $id; } else { $id = 'database-' . $id; $cfg = $this->cfg($id); } } if (!$cfg || $this->cfg('options.skip_database')) { $cfg['engine'] = 'null'; self::dprint('Missing database configuration section', core::E_CRIT); } $connection = db_loader::set(null, $cfg); if (!$connection) { throw new core_exception('Database connection problem', tf_exception::CRITICAL); } // default connection self::register_lib('db', $connection); }