*/
class dba {
- public static $connected = true;
+ public static $connected = false;
private static $_server_info = '';
private static $db;
$db = trim($db);
if (!(strlen($server) && strlen($user))) {
- self::$connected = false;
- self::$db = null;
return false;
}
if (strlen($server) && ($server !== 'localhost') && ($server !== '127.0.0.1')) {
if (! dns_get_record($server, DNS_A + DNS_CNAME + DNS_PTR)) {
self::$error = L10n::t('Cannot locate DNS info for database server \'%s\'', $server);
- self::$connected = false;
- self::$db = null;
return false;
}
}
self::$db = @new PDO($connect, $user, $pass);
self::$connected = true;
} catch (PDOException $e) {
- self::$connected = false;
}
}
// No suitable SQL driver was found.
if (!self::$connected) {
self::$db = null;
- if (!$install) {
- System::unavailable();
- }
}
$a->save_timestamp($stamp1, "network");
- return true;
+ return self::$connected;
}
/**
require_once "include/dba.php";
if (!$install) {
- dba::connect($db_host, $db_user, $db_pass, $db_data, $install);
+ $result = dba::connect($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
+ if (!$result) {
+ System::unavailable();
+ }
+
/**
* Load configs from db. Overwrite configs from .htconfig.php
*/