GX-Bug #48537 » UpdaterMySQLiSocketPortFix.patch
src/gambio_updater/classes/RequirementsTesting.inc.php (revision ) | ||
---|---|---|
401 | 401 |
require_once(dirname(__FILE__) . '/../../includes/configure.php'); |
402 | 402 |
} |
403 | 403 |
|
404 |
$host = DB_SERVER; |
|
405 |
$port = ini_get("mysqli.default_port"); |
|
406 |
$socket = ini_get("mysqli.default_socket"); |
|
404 |
$server = DB_SERVER; |
|
407 | 405 |
|
408 |
if(strstr($host, ':'))
|
|
409 |
{
|
|
410 |
$host = explode(':', $host);
|
|
406 |
$port = isset(explode(':', $server)[1]) && is_numeric(explode(':', $server)[1]) ? (int)explode(':', $server)[1] : null;
|
|
407 |
$socket = isset(explode(':', $server)[1]) && !is_numeric(explode(':', $server)[1]) ? explode(':', $server)[1] : null;
|
|
408 |
$server = explode(':', $server)[0];
|
|
411 | 409 |
|
412 |
if(is_numeric($host[1])) |
|
413 |
{ |
|
414 |
$port = $host[1]; |
|
415 |
} |
|
416 |
else |
|
417 |
{ |
|
418 |
$socket = $host[1]; |
|
419 |
} |
|
420 |
|
|
421 |
$host = $host[0]; |
|
422 |
} |
|
423 |
|
|
424 |
return new mysqli($host, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, $port, $socket); |
|
410 |
return new mysqli($server, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, $port, $socket); |
|
425 | 411 |
} |
426 | 412 |
|
427 | 413 |
|