Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
79ac5a8c
Commit
79ac5a8c
authored
Jan 14, 2011
by
Petr Skoda
Browse files
MDL-25910 add support for custom mysql socket location
parent
5a7f931e
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/dml/mysqli_native_moodle_database.php
View file @
79ac5a8c
...
...
@@ -264,15 +264,21 @@ class mysqli_native_moodle_database extends moodle_database {
}
$this
->
store_settings
(
$dbhost
,
$dbuser
,
$dbpass
,
$dbname
,
$prefix
,
$dboptions
);
unset
(
$this
->
dboptions
[
'dbsocket'
]);
// dbsocket is used ONLY if host is NULL or 'localhost',
// you can not disable it because it is always tried if dbhost is 'localhost'
if
(
!
empty
(
$this
->
dboptions
[
'dbsocket'
])
and
strpos
(
$this
->
dboptions
[
'dbsocket'
],
'/'
)
!==
false
)
{
$dbsocket
=
$this
->
dboptions
[
'dbsocket'
];
}
else
{
$dbsocket
=
ini_get
(
'mysqli.default_socket'
);
}
if
(
empty
(
$this
->
dboptions
[
'dbport'
]))
{
$dbport
=
ini_get
(
'mysqli.default_port'
);
}
else
{
$dbport
=
(
int
)
$this
->
dboptions
[
'dbport'
];
}
ob_start
();
$this
->
mysqli
=
new
mysqli
(
$dbhost
,
$dbuser
,
$dbpass
,
$dbname
,
$dbport
);
$this
->
mysqli
=
new
mysqli
(
$dbhost
,
$dbuser
,
$dbpass
,
$dbname
,
$dbport
,
$dbsocket
);
$dberr
=
ob_get_contents
();
ob_end_clean
();
$errorno
=
@
$this
->
mysqli
->
connect_errno
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment