public static function initialiseDatabase()
    {
        self::setDatabase();
        $details = self::Configuration()->get('database');

        try {
            if (!self::Database()->connect($details['host'], $details['user'], $details['password'], $details['port'], $details['db'])) {
                return false;
            }

            if (!self::Database()->isConnected()) {
                return false;
            }

            self::Database()->setPrefix($details['tbl_prefix']);
            self::Database()->setCharacterEncoding();
            self::Database()->setCharacterSet();
            self::Database()->setTimeZone(self::Configuration()->get('timezone', 'region'));

            if (isset($details['query_caching'])) {
                if ($details['query_caching'] == 'off') {
                    self::Database()->disableCaching();
                } elseif ($details['query_caching'] == 'on') {
                    self::Database()->enableCaching();
                }
            }

            if (isset($details['query_logging'])) {
                if ($details['query_logging'] == 'off') {
                    self::Database()->disableLogging();
                } elseif ($details['query_logging'] == 'on') {
                    self::Database()->enableLogging();
                }
            }
        } catch (DatabaseException $e) {
            self::throwCustomError(
                $e->getDatabaseErrorCode() . ': ' . $e->getDatabaseErrorMessage(),
                __('Symphony Database Error'),
                Page::HTTP_STATUS_ERROR,
                'database',
                array(
                    'error' => $e,
                    'message' => __('There was a problem whilst attempting to establish a database connection. Please check all connection information is correct.') . ' ' . __('The following error was returned:')
                )
            );
        }

        return true;
    }
public static function initialiseDatabase()
    {
        self::setDatabase();
        $details = self::Configuration()->get('database');

        try {
            if (!self::Database()->connect($details['host'], $details['user'], $details['password'], $details['port'], $details['db'])) {
                return false;
            }

            if (!self::Database()->isConnected()) {
                return false;
            }

            self::Database()->setPrefix($details['tbl_prefix']);
            self::Database()->setCharacterEncoding();
            self::Database()->setCharacterSet();
            self::Database()->setTimeZone(self::Configuration()->get('timezone', 'region'));

            if (isset($details['query_caching'])) {
                if ($details['query_caching'] == 'off') {
                    self::Database()->disableCaching();
                } elseif ($details['query_caching'] == 'on') {
                    self::Database()->enableCaching();
                }
            }

            if (isset($details['query_logging'])) {
                if ($details['query_logging'] == 'off') {
                    self::Database()->disableLogging();
                } elseif ($details['query_logging'] == 'on') {
                    self::Database()->enableLogging();
                }
            }
        } catch (DatabaseException $e) {
            self::throwCustomError(
                $e->getDatabaseErrorCode() . ': ' . $e->getDatabaseErrorMessage(),
                __('Symphony Database Error'),
                Page::HTTP_STATUS_ERROR,
                'database',
                array(
                    'error' => $e,
                    'message' => __('There was a problem whilst attempting to establish a database connection. Please check all connection information is correct.') . ' ' . __('The following error was returned:')
                )
            );
        }

        return true;
    }
public static function initialiseDatabase ( ) { self :: setDatabase ( ) ; $ details = self :: Configuration ( ) -> get ( 'database' ) ; try { if ( ! self :: Database ( ) -> connect ( $ details [ 'host' ] , $ details [ 'user' ] , $ details [ 'password' ] , $ details [ 'port' ] , $ details [ 'db' ] ) ) { return false ; } if ( ! self :: Database ( ) -> isConnected ( ) ) { return false ; } self :: Database ( ) -> setPrefix ( $ details [ 'tbl_prefix' ] ) ; self :: Database ( ) -> setCharacterEncoding ( ) ; self :: Database ( ) -> setCharacterSet ( ) ; self :: Database ( ) -> setTimeZone ( self :: Configuration ( ) -> get ( 'timezone' , 'region' ) ) ; if ( isset ( $ details [ 'query_caching' ] ) ) { if ( $ details [ 'query_caching' ] == 'off' ) { self :: Database ( ) -> disableCaching ( ) ; } elseif ( $ details [ 'query_caching' ] == 'on' ) { self :: Database ( ) -> enableCaching ( ) ; } } if ( isset ( $ details [ 'query_logging' ] ) ) { if ( $ details [ 'query_logging' ] == 'off' ) { self :: Database ( ) -> disableLogging ( ) ; } elseif ( $ details [ 'query_logging' ] == 'on' ) { self :: Database ( ) -> enableLogging ( ) ; } } } catch ( DatabaseException $ e ) { self :: throwCustomError ( $ e -> getDatabaseErrorCode ( ) . ': ' . $ e -> getDatabaseErrorMessage ( ) , __ ( 'Symphony Database Error' ) , Page :: HTTP_STATUS_ERROR , 'database' , array ( 'error' => $ e , 'message' => __ ( 'There was a problem whilst attempting to establish a database connection. Please check all connection information is correct.' ) . ' ' . __ ( 'The following error was returned:' ) ) ) ; } return true ; }
This will initialise the Database class and attempt to create a connection
using the connection details provided in the Symphony configuration. If any
errors occur whilst doing so, a Symphony Error Page is displayed.

@throws SymphonyErrorPage
@return boolean
This function will return true if the `$Database` was
initialised successfully.
This will initialise the Database class and attempt to create a connection using the connection details provided in the Symphony configuration . If any errors occur whilst doing so a Symphony Error Page is displayed .