src/ORM/DB.php
public static function get_alternative_database_name()
    {
        // Ignore if disabled
        if (!Config::inst()->get(static::class, 'alternative_database_enabled')) {
            return false;
        }
        // Skip if CLI
        if (Director::is_cli()) {
            return false;
        }
        // Skip if there's no request object yet
        if (!Injector::inst()->has(HTTPRequest::class)) {
            return null;
        }
        /** @var HTTPRequest $request */
        $request = Injector::inst()->get(HTTPRequest::class);
        // Skip if the session hasn't been started
        if (!$request->getSession()->isStarted()) {
            return null;
        }

        $name = $request->getSession()->get(self::ALT_DB_KEY);
        if (self::valid_alternative_database_name($name)) {
            return $name;
        }

        return false;
    }
public static function get_alternative_database_name()
    {
        // Ignore if disabled
        if (!Config::inst()->get(static::class, 'alternative_database_enabled')) {
            return false;
        }
        // Skip if CLI
        if (Director::is_cli()) {
            return false;
        }
        // Skip if there's no request object yet
        if (!Injector::inst()->has(HTTPRequest::class)) {
            return null;
        }
        /** @var HTTPRequest $request */
        $request = Injector::inst()->get(HTTPRequest::class);
        // Skip if the session hasn't been started
        if (!$request->getSession()->isStarted()) {
            return null;
        }

        $name = $request->getSession()->get(self::ALT_DB_KEY);
        if (self::valid_alternative_database_name($name)) {
            return $name;
        }

        return false;
    }
public static function get_alternative_database_name ( ) { // Ignore if disabled if ( ! Config :: inst ( ) -> get ( static :: class , 'alternative_database_enabled' ) ) { return false ; } // Skip if CLI if ( Director :: is_cli ( ) ) { return false ; } // Skip if there's no request object yet if ( ! Injector :: inst ( ) -> has ( HTTPRequest :: class ) ) { return null ; } /** @var HTTPRequest $request */ $ request = Injector :: inst ( ) -> get ( HTTPRequest :: class ) ; // Skip if the session hasn't been started if ( ! $ request -> getSession ( ) -> isStarted ( ) ) { return null ; } $ name = $ request -> getSession ( ) -> get ( self :: ALT_DB_KEY ) ; if ( self :: valid_alternative_database_name ( $ name ) ) { return $ name ; } return false ; }
Get the name of the database in use

@return string|false Name of temp database, or false if not set
Get the name of the database in use