Flake\Framework::initDbMysql PHP Méthode

initDbMysql() protected static méthode

protected static initDbMysql ( )
    protected static function initDbMysql()
    {
        if (!defined("PROJECT_DB_MYSQL_HOST")) {
            die("<h3>The constant PROJECT_DB_MYSQL_HOST, containing the MySQL host name, is not set.<br />You should set it in Specific/config.system.php</h3>");
        }
        if (!defined("PROJECT_DB_MYSQL_DBNAME")) {
            die("<h3>The constant PROJECT_DB_MYSQL_DBNAME, containing the MySQL database name, is not set.<br />You should set it in Specific/config.system.php</h3>");
        }
        if (!defined("PROJECT_DB_MYSQL_USERNAME")) {
            die("<h3>The constant PROJECT_DB_MYSQL_USERNAME, containing the MySQL database username, is not set.<br />You should set it in Specific/config.system.php</h3>");
        }
        if (!defined("PROJECT_DB_MYSQL_PASSWORD")) {
            die("<h3>The constant PROJECT_DB_MYSQL_PASSWORD, containing the MySQL database password, is not set.<br />You should set it in Specific/config.system.php</h3>");
        }
        try {
            $GLOBALS["DB"] = new \Flake\Core\Database\Mysql(PROJECT_DB_MYSQL_HOST, PROJECT_DB_MYSQL_DBNAME, PROJECT_DB_MYSQL_USERNAME, PROJECT_DB_MYSQL_PASSWORD);
            # We now setup t6he connexion to use UTF8
            $GLOBALS["DB"]->query("SET NAMES UTF8");
        } catch (\Exception $e) {
            die("<h3>Baïkal was not able to establish a connexion to the configured MySQL database (as configured in Specific/config.system.php).</h3>");
        }
        return true;
    }