/** * Initialises the database connection for the 'otherdb' cache type. * @return moodle_database the DB connection to use. */ protected static function get_other_db() { if (!is_null(self::$otherdb)) { return self::$otherdb; } $dboptions = array(); if (!empty(self::$config->cascachedbsocket)) { $dboptions['dbsocket'] = true; } self::$otherdb = moodle_database::get_driver_instance(self::$config->cascachedbtype, self::$config->cascachedblibrary); self::$otherdb->connect(self::$config->cascachedbhost, self::$config->cascachedbuser, self::$config->cascachedbpass, self::$config->cascachedbname, self::$config->cascachedbprefix, $dboptions); return self::$otherdb; }