irm/lib/Config.php
/* ====================================================
     * Bit more than a singleton
     * Allows changing the dsn
     */
Bit more than a singleton
Allows changing the dsn
Bit more than a singleton Allows changing the dsn
static function Database()
    {
        require_once dirname(__FILE__) . '/../lib/IRMDB.php';
        global $DB;
        $dbcfg = Config::CurrentSection('database');
        if (!@$dbcfg['DSN'])
        {
            trigger_error(sprintf(_("No DSN found for section [%s]"), $_SESSION['_sess_database']), E_USER_ERROR);
        }
        if (!$DB)
        {
            $DB = new IRMDB($dbcfg['DSN']);
        }
        if ($dbcfg['DSN'] !== $DB->getDSN())
        {
            unset($DB);
            $DB = new IRMDB($dbcfg['DSN']);
        }
        return $DB;
    }
static function Database ( ) { require_once dirname ( __FILE__ ) . '/../lib/IRMDB.php' ; global $ DB ; $ dbcfg = Config :: CurrentSection ( 'database' ) ; if ( ! @ $ dbcfg [ 'DSN' ] ) { trigger_error ( sprintf ( _ ( " No DSN found for section [%s] " ) , $ _SESSION [ '_sess_database' ] ) , E_USER_ERROR ) ; } if ( ! $ DB ) { $ DB = new IRMDB ( $ dbcfg [ 'DSN' ] ) ; } if ( $ dbcfg [ 'DSN' ] !== $ DB -> getDSN ( ) ) { unset ( $ DB ) ; $ DB = new IRMDB ( $ dbcfg [ 'DSN' ] ) ; } return $ DB ; }
Bit more than a singleton
 Allows changing the dsn
Bit more than a singleton Allows changing the dsn