Commit 8cb432d0 authored by ale's avatar ale Committed by lucha

Switch apache2-noblogs port to :92

parent c1556448
...@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment