Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
r2db
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Noblogs
r2db
Commits
47f89733
Commit
47f89733
authored
13 years ago
by
ale
Committed by
lucha
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
support split master/slave backends for the primary database
parent
7d399db3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
db-backends.php
+15
-1
15 additions, 1 deletion
db-backends.php
with
15 additions
and
1 deletion
db-backends.php
+
15
−
1
View file @
47f89733
...
...
@@ -25,7 +25,7 @@ function noblogs_load_backends($db_config_file, $hashptr) {
"password"
=>
$backend_url_data
[
"pass"
],
"name"
=>
substr
(
$backend_url_data
[
"path"
],
1
),
"dataset"
=>
$dataset
,
"read"
=>
1
,
"write"
=>
1
,
"timeout"
=>
2
"read"
=>
1
,
"write"
=>
1
,
"timeout"
=>
10
);
$wpdb
->
add_database
(
$backend
);
$hashptr
->
addTarget
(
$dataset
);
...
...
@@ -34,3 +34,17 @@ function noblogs_load_backends($db_config_file, $hashptr) {
fclose
(
$fp
);
return
$backend_map
;
}
function
noblogs_load_master
(
$master_file
)
{
$master_url
=
trim
(
file_get_contents
(
$master_file
));
$mdata
=
parse_url
(
$master_url
);
return
array
(
"host"
=>
$mdata
[
"host"
]
.
":"
.
$mdata
[
"port"
],
"user"
=>
$mdata
[
"user"
],
"password"
=>
$mdata
[
"pass"
],
"name"
=>
substr
(
$mdata
[
"path"
],
1
),
"dataset"
=>
"global"
,
"read"
=>
0
,
"write"
=>
1
,
"timeout"
=>
10
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment