Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -701,14 +701,16 @@ |
702 | 702 | * @return string |
703 | 703 | */ |
704 | 704 | function wfReportTime() { |
705 | | - global $wgRequestTime; |
| 705 | + global $wgRequestTime, $wgShowHostnames; |
706 | 706 | |
707 | 707 | $now = wfTime(); |
708 | 708 | $elapsed = $now - $wgRequestTime; |
709 | 709 | |
710 | | - $com = sprintf( "<!-- Served by %s in %01.3f secs. -->", |
711 | | - wfHostname(), $elapsed ); |
712 | | - return $com; |
| 710 | + if ($wgShowHostnames) { |
| 711 | + return sprintf( "<!-- Served by %s in %01.3f secs. -->", wfHostname(), $elapsed ); |
| 712 | + } else { |
| 713 | + return sprintf( "<!-- Served in %01.3f secs. -->", $elapsed ); |
| 714 | + } |
713 | 715 | } |
714 | 716 | |
715 | 717 | /** |
Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php |
— | — | @@ -132,11 +132,14 @@ |
133 | 133 | } |
134 | 134 | |
135 | 135 | protected function appendDbReplLagInfo($property, $includeAll) { |
136 | | - global $wgLoadBalancer; |
| 136 | + global $wgLoadBalancer, $wgShowHostnames; |
137 | 137 | |
138 | 138 | $data = array(); |
139 | 139 | |
140 | 140 | if ($includeAll) { |
| 141 | + if (!$wgShowHostnames) |
| 142 | + $this->dieUsage('Cannot view all servers info unless $wgShowHostnames is true', 'includeAllDenied'); |
| 143 | + |
141 | 144 | global $wgDBservers; |
142 | 145 | $lags = $wgLoadBalancer->getLagTimes(); |
143 | 146 | foreach( $lags as $i => $lag ) { |
— | — | @@ -147,7 +150,7 @@ |
148 | 151 | } else { |
149 | 152 | list( $host, $lag ) = $wgLoadBalancer->getMaxLag(); |
150 | 153 | $data[] = array ( |
151 | | - 'host' => $host, |
| 154 | + 'host' => $wgShowHostnames ? $host : '', |
152 | 155 | 'lag' => $lag); |
153 | 156 | } |
154 | 157 | |
Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -57,14 +57,19 @@ |
58 | 58 | } |
59 | 59 | |
60 | 60 | function checkMaxLag( $maxLag ) { |
61 | | - global $wgLoadBalancer; |
| 61 | + global $wgLoadBalancer, $wgShowHostnames; |
| 62 | + |
62 | 63 | list( $host, $lag ) = $wgLoadBalancer->getMaxLag(); |
63 | 64 | if ( $lag > $maxLag ) { |
64 | 65 | header( 'HTTP/1.1 503 Service Unavailable' ); |
65 | 66 | header( 'Retry-After: ' . max( intval( $maxLag ), 5 ) ); |
66 | 67 | header( 'X-Database-Lag: ' . intval( $lag ) ); |
67 | 68 | header( 'Content-Type: text/plain' ); |
68 | | - echo "Waiting for $host: $lag seconds lagged\n"; |
| 69 | + if ($wgShowHostnames) { |
| 70 | + echo "Waiting for $host: $lag seconds lagged\n"; |
| 71 | + } else { |
| 72 | + echo "Waiting for a database server: $lag seconds lagged\n"; |
| 73 | + } |
69 | 74 | return false; |
70 | 75 | } else { |
71 | 76 | return true; |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -921,7 +921,11 @@ |
922 | 922 | $wgShowExceptionDetails = false; |
923 | 923 | |
924 | 924 | /** |
925 | | - * disable experimental dmoz-like category browsing. Output things like: |
| 925 | + * If set to true, exposes host names through API and HTML comments. |
| 926 | + */ |
| 927 | +$wgShowHostnames = false; |
| 928 | + |
| 929 | +/** * disable experimental dmoz-like category browsing. Output things like: |
926 | 930 | * Encyclopedia > Music > Style of Music > Jazz |
927 | 931 | */ |
928 | 932 | $wgUseCategoryBrowser = false; |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -25,6 +25,7 @@ |
26 | 26 | * $wgAddGroups, $wgRemoveGroups - Finer control over who can assign which |
27 | 27 | usergroups |
28 | 28 | * $wgEnotifImpersonal, $wgEnotifUseJobQ - Bulk mail options for large sites |
| 29 | +* $wgShowHostnames - Shows host names in API results and HTML comments |
29 | 30 | |
30 | 31 | == New features since 1.10 == |
31 | 32 | |