Skip to content
Snippets Groups Projects
Commit cc631249 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #693 from greezybacon/feature/persistent-db


mysqli: Allow for persistent database spec

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 0e16129f 58d0d072
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,9 @@ function db_connect($host, $user, $passwd, $options = array()) {
$port = ini_get("mysqli.default_port");
$socket = ini_get("mysqli.default_socket");
$persistent = stripos($host, 'p:') === 0;
if ($persistent)
$host = substr($host, 2);
if (strpos($host, ':') !== false) {
list($host, $portspec) = explode(':', $host);
// PHP may not honor the port number if connecting to 'localhost'
......@@ -54,6 +57,9 @@ function db_connect($host, $user, $passwd, $options = array()) {
}
}
if ($persistent)
$host = 'p:' . $host;
// Connect
$start = microtime(true);
if (!@$__db->real_connect($host, $user, $passwd, null, $port, $socket))
......
......@@ -60,6 +60,7 @@ class Installer extends SetupWizard {
$f['dbuser'] = array('type'=>'string', 'required'=>1, 'error'=>'Username required');
$f['dbpass'] = array('type'=>'string', 'required'=>1, 'error'=>'password required');
$vars = array_map('trim', $vars);
if(!Validator::process($f,$vars,$this->errors) && !$this->errors['err'])
$this->errors['err']='Missing or invalid data - correct the errors and try again.';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment