Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
83aac064
Commit
83aac064
authored
Feb 22, 2016
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor refactoring (qa-db.php)
parent
6da77203
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
qa-db.php
qa-include/qa-db.php
+10
-7
No files found.
qa-include/qa-db.php
View file @
83aac064
...
...
@@ -59,22 +59,25 @@
if
(
$qa_db_connection
instanceof
mysqli
)
return
;
// in mysqli we connect and select database in constructor
$host
=
QA_PERSISTENT_CONN_DB
?
'p:'
.
QA_FINAL_MYSQL_HOSTNAME
:
QA_FINAL_MYSQL_HOSTNAME
;
$host
=
QA_FINAL_MYSQL_HOSTNAME
;
$port
=
null
;
if
(
defined
(
'QA_FINAL_WORDPRESS_INTEGRATE_PATH'
))
{
$host_and_port
=
preg_split
(
'/:/'
,
$host
);
if
(
count
(
$host_and_port
)
=
=
2
)
{
$host
=
QA_PERSISTENT_CONN_DB
?
'p:'
.
$host_and_port
[
0
]
:
$host_and_port
[
0
];
// Wordpress allows setting port inside DB_HOST constant, like 127.0.0.1:3306
$host_and_port
=
explode
(
':'
,
$host
);
if
(
count
(
$host_and_port
)
>
=
2
)
{
$host
=
$host_and_port
[
0
];
$port
=
$host_and_port
[
1
];
}
}
elseif
(
defined
(
'QA_FINAL_MYSQL_PORT'
))
{
$port
=
QA_FINAL_MYSQL_PORT
;
}
if
(
!
is_null
(
$port
))
if
(
QA_PERSISTENT_CONN_DB
)
$host
=
'p:'
.
$host
;
// in mysqli we connect and select database in constructor
if
(
$port
!==
null
)
$db
=
new
mysqli
(
$host
,
QA_FINAL_MYSQL_USERNAME
,
QA_FINAL_MYSQL_PASSWORD
,
QA_FINAL_MYSQL_DATABASE
,
$port
);
else
$db
=
new
mysqli
(
$host
,
QA_FINAL_MYSQL_USERNAME
,
QA_FINAL_MYSQL_PASSWORD
,
QA_FINAL_MYSQL_DATABASE
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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