Beispiel #1
0
function phorum_check_database($is_install = false)
{
    $PHORUM = $GLOBALS["PHORUM"];
    // Check if we have a database configuration available.
    if (!isset($PHORUM["DBCONFIG"])) {
        return array(PHORUM_SANITY_CRIT, "No database configuration was found in your environment.", "You probably have not copied include/db/config.php.sample\n             to include/db/config.php. Read Phorum's install.txt for\n             installation instructions.");
    }
    // Check if a connection can be made.
    $connected = @phorum_db_check_connection();
    if (!$connected) {
        return array(PHORUM_SANITY_CRIT, "Connecting to the database failed.", "Check your database settings in the file include/db/conf.php");
    }
    // Do a database layer specific check, if available.
    if (function_exists("phorum_db_sanitychecks")) {
        $res = phorum_db_sanitychecks();
        if ($res[0] != PHORUM_SANITY_OK) {
            return $res;
        }
    }
    if ($is_install && empty($PHORUM['DBCONFIG']['charset'])) {
        return array(PHORUM_SANITY_WARN, "Database configuration parameter \"charset\" empty.", "The option \"charset\" is empty in your database configuration.\n             Although you can install Phorum without setting an explicit\n             charset here, we strongly advice against this. Without a\n             specific charset here, you might run into problems with\n             special characters later on.");
    }
    // All checks are OK.
    return array(PHORUM_SANITY_OK, NULL, NULL);
}
Beispiel #2
0
    function phorum_check_database() {
        $PHORUM = $GLOBALS["PHORUM"];

        // Check if we have a database configuration available.
        if (! isset($PHORUM["DBCONFIG"])) return array(
            PHORUM_SANITY_CRIT,
            "No database configuration was found in your environment.",
            "You probably have not copied include/db/config.php.sample
             to include/db/config.php. Read Phorum's install.txt for
             installation instructions."
        );

        // Check if a connection can be made.
        $connected = @phorum_db_check_connection();
        if (! $connected) return array(
            PHORUM_SANITY_CRIT,
            "Connecting to the database failed.",
            "Check your database settings in the file include/db/conf.php"
        );

        // Do a database layer specific check, if available.
        if (function_exists("phorum_db_sanitychecks")) {
            $res = phorum_db_sanitychecks();
            if ($res[0] != PHORUM_SANITY_OK) return $res;
        }

        // All checks are OK.
        return array(PHORUM_SANITY_OK, NULL);
    }