mirror of
https://github.com/friendica/friendica
synced 2024-11-14 05:02:54 +00:00
don't let somebody install with a bogus db hostname as this seems to lead to spectacular failure modes
This commit is contained in:
parent
a912a0d3ca
commit
0cf647bf6f
2 changed files with 17 additions and 1 deletions
2
boot.php
2
boot.php
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
define ( 'FRIENDIKA_VERSION', '2.1.915' );
|
define ( 'FRIENDIKA_VERSION', '2.1.917' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.1' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.1' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1040 );
|
define ( 'DB_UPDATE_VERSION', 1040 );
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,22 @@ class dba {
|
||||||
public $connected = false;
|
public $connected = false;
|
||||||
|
|
||||||
function __construct($server,$user,$pass,$db,$install = false) {
|
function __construct($server,$user,$pass,$db,$install = false) {
|
||||||
|
$server = trim($server);
|
||||||
|
$user = trim($user);
|
||||||
|
$pass = trim($pass);
|
||||||
|
$db = trim($db);
|
||||||
|
|
||||||
|
if($install) {
|
||||||
|
if(strlen($server) && ($server !== 'localhost') && ($server !== '127.0.0.1')) {
|
||||||
|
if(! dns_get_record($server, DNS_A + DNS_CNAME + DNS_PTR)) {
|
||||||
|
notice( sprintf( t('Cannot locate DNS info for database server \'%s\'',$server)));
|
||||||
|
$this->connected = false;
|
||||||
|
$this->db = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->db = @new mysqli($server,$user,$pass,$db);
|
$this->db = @new mysqli($server,$user,$pass,$db);
|
||||||
if(! mysqli_connect_errno()) {
|
if(! mysqli_connect_errno()) {
|
||||||
$this->connected = true;
|
$this->connected = true;
|
||||||
|
|
Loading…
Reference in a new issue