Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ai
noblogs-wp
Commits
8cb432d0
Commit
8cb432d0
authored
Nov 02, 2017
by
ale
Committed by
lucha
Dec 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch apache2-noblogs port to :92
parent
c1556448
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
wp-nginx-map.php
wp-nginx-map.php
+6
-3
No files found.
wp-nginx-map.php
View file @
8cb432d0
...
@@ -11,6 +11,9 @@ $noblogs_master = parse_url($master_url)['host'];
...
@@ -11,6 +11,9 @@ $noblogs_master = parse_url($master_url)['host'];
define
(
'WP_CACHE'
,
false
);
define
(
'WP_CACHE'
,
false
);
require_once
(
'/opt/noblogs/www/wp-load.php'
);
require_once
(
'/opt/noblogs/www/wp-load.php'
);
// Port that the noblogs apache2 instance is listening on (as a string).
define
(
'NOBLOGS_PORT'
,
'92'
);
// Return all blogs.
// Return all blogs.
function
get_blogs
()
{
function
get_blogs
()
{
global
$wpdb
;
global
$wpdb
;
...
@@ -26,10 +29,10 @@ function printline($s) {
...
@@ -26,10 +29,10 @@ function printline($s) {
function
backend_to_http_endpoint
(
$backend
)
{
function
backend_to_http_endpoint
(
$backend
)
{
if
(
substr
(
$backend
,
0
,
8
)
!=
'backend_'
)
{
if
(
substr
(
$backend
,
0
,
8
)
!=
'backend_'
)
{
error_log
(
'diamine, di questo backend non so che farmene: '
.
$backend
);
error_log
(
'diamine, di questo backend non so che farmene: '
.
$backend
);
return
$noblogs_master
.
':
82'
;
return
$noblogs_master
.
':
'
.
NOBLOGS_PORT
;
}
}
$id
=
substr
(
$backend
,
8
);
$id
=
substr
(
$backend
,
8
);
return
'172.16.1.'
.
$id
.
':
82'
;
return
'172.16.1.'
.
$id
.
':
'
.
NOBLOGS_PORT
;
}
}
// Print the blog -> backend map.
// Print the blog -> backend map.
...
@@ -39,7 +42,7 @@ function generate_backend_map($blogs) {
...
@@ -39,7 +42,7 @@ function generate_backend_map($blogs) {
$wpdb_hash
=
&
$wpdb
->
hash_map
;
$wpdb_hash
=
&
$wpdb
->
hash_map
;
printline
(
'map $http_host $backend_noblogs {'
);
printline
(
'map $http_host $backend_noblogs {'
);
printline
(
' default http://'
.
$noblogs_master
.
':
82
;'
);
printline
(
' default http://'
.
$noblogs_master
.
':
'
.
NOBLOGS_PORT
.
'
;'
);
foreach
(
$blogs
as
$blog
)
{
foreach
(
$blogs
as
$blog
)
{
$blog_id
=
$blog
->
blog_id
;
$blog_id
=
$blog
->
blog_id
;
if
(
$blog_id
==
1
)
if
(
$blog_id
==
1
)
...
...
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