Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -3061,26 +3061,6 @@ |
3062 | 3062 | } |
3063 | 3063 | |
3064 | 3064 | /** |
3065 | | - * Displays a maxlag error |
3066 | | - * |
3067 | | - * @param $host String: server that lags the most |
3068 | | - * @param $lag Integer: maxlag (actual) |
3069 | | - * @param $maxLag Integer: maxlag (requested) |
3070 | | - */ |
3071 | | -function wfMaxlagError( $host, $lag, $maxLag ) { |
3072 | | - global $wgShowHostnames; |
3073 | | - header( 'HTTP/1.1 503 Service Unavailable' ); |
3074 | | - header( 'Retry-After: ' . max( intval( $maxLag ), 5 ) ); |
3075 | | - header( 'X-Database-Lag: ' . intval( $lag ) ); |
3076 | | - header( 'Content-Type: text/plain' ); |
3077 | | - if( $wgShowHostnames ) { |
3078 | | - echo "Waiting for $host: $lag seconds lagged\n"; |
3079 | | - } else { |
3080 | | - echo "Waiting for a database server: $lag seconds lagged\n"; |
3081 | | - } |
3082 | | -} |
3083 | | - |
3084 | | -/** |
3085 | 3065 | * Throws a warning that $function is deprecated |
3086 | 3066 | * @param $function String |
3087 | 3067 | * @return null |
Index: trunk/phase3/index.php |
— | — | @@ -37,24 +37,34 @@ |
38 | 38 | * @file |
39 | 39 | */ |
40 | 40 | |
41 | | -# Initialise common code |
| 41 | +# Initialise common code. This gives us access to GlobalFunctions, the AutoLoader, and |
| 42 | +# the globals $wgRequest, $wgOut, $wgUser, $wgLang and $wgContLang, amongst others; it |
| 43 | +# does *not* load $wgTitle or $wgArticle |
42 | 44 | require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); |
43 | 45 | |
44 | 46 | wfProfileIn( 'index.php' ); |
45 | 47 | wfProfileIn( 'index.php-setup' ); |
46 | 48 | |
47 | | -# Initialize MediaWiki base class |
48 | | -$mediaWiki = new MediaWiki( $wgRequest, $wgOut ); |
49 | | - |
50 | 49 | $maxLag = $wgRequest->getVal( 'maxlag' ); |
51 | 50 | if ( !is_null( $maxLag ) ) { |
52 | 51 | list( $host, $lag ) = wfGetLB()->getMaxLag(); |
53 | 52 | if ( $lag > $maxLag ) { |
54 | | - wfMaxlagError( $host, $lag, $maxLag ); |
| 53 | + header( 'HTTP/1.1 503 Service Unavailable' ); |
| 54 | + header( 'Retry-After: ' . max( intval( $maxLag ), 5 ) ); |
| 55 | + header( 'X-Database-Lag: ' . intval( $lag ) ); |
| 56 | + header( 'Content-Type: text/plain' ); |
| 57 | + if( $wgShowHostnames ) { |
| 58 | + echo "Waiting for $host: $lag seconds lagged\n"; |
| 59 | + } else { |
| 60 | + echo "Waiting for a database server: $lag seconds lagged\n"; |
| 61 | + } |
55 | 62 | exit; |
56 | 63 | } |
57 | 64 | } |
58 | 65 | |
| 66 | +# Initialize MediaWiki base class |
| 67 | +$mediaWiki = new MediaWiki( $wgRequest, $wgOut ); |
| 68 | + |
59 | 69 | # Set title from request parameters |
60 | 70 | $wgTitle = $mediaWiki->checkInitialQueries(); |
61 | 71 | $action = $wgRequest->getVal( 'action', 'view' ); |