Index: trunk/phase3/includes/Exception.php |
— | — | @@ -188,12 +188,11 @@ |
189 | 189 | die( $hookResult ); |
190 | 190 | } |
191 | 191 | |
192 | | - if ( defined( 'MEDIAWIKI_INSTALL' ) || $this->htmlBodyOnly() ) { |
193 | | - echo $this->getHTML(); |
| 192 | + $html = $this->getHTML(); |
| 193 | + if ( defined( 'MEDIAWIKI_INSTALL' ) ) { |
| 194 | + echo $html; |
194 | 195 | } else { |
195 | | - echo $this->htmlHeader(); |
196 | | - echo $this->getHTML(); |
197 | | - echo $this->htmlFooter(); |
| 196 | + wfDie( $html ); |
198 | 197 | } |
199 | 198 | } |
200 | 199 | } |
— | — | @@ -219,6 +218,7 @@ |
220 | 219 | /** |
221 | 220 | * Send headers and output the beginning of the html page if not using |
222 | 221 | * $wgOut to output the exception. |
| 222 | + * @deprecated since 1.18 call wfDie() if you need to die immediately |
223 | 223 | */ |
224 | 224 | function htmlHeader() { |
225 | 225 | global $wgLogo, $wgLang; |
— | — | @@ -273,18 +273,12 @@ |
274 | 274 | |
275 | 275 | /** |
276 | 276 | * print the end of the html page if not using $wgOut. |
| 277 | + * @deprecated since 1.18 |
277 | 278 | */ |
278 | 279 | function htmlFooter() { |
279 | 280 | return Html::closeElement( 'body' ) . Html::closeElement( 'html' ); |
280 | 281 | } |
281 | 282 | |
282 | | - /** |
283 | | - * headers handled by subclass? |
284 | | - */ |
285 | | - function htmlBodyOnly() { |
286 | | - return false; |
287 | | - } |
288 | | - |
289 | 283 | static function isCommandLine() { |
290 | 284 | return !empty( $GLOBALS['wgCommandLineMode'] ) && !defined( 'MEDIAWIKI_INSTALL' ); |
291 | 285 | } |
Index: trunk/phase3/includes/db/Database.php |
— | — | @@ -2970,6 +2970,13 @@ |
2971 | 2971 | |
2972 | 2972 | $extra = $this->searchForm(); |
2973 | 2973 | |
| 2974 | + return "$text<hr />$extra"; |
| 2975 | + } |
| 2976 | + |
| 2977 | + public function reportHTML(){ |
| 2978 | + global $wgUseFileCache; |
| 2979 | + |
| 2980 | + # Check whether we can serve a file-cached copy of the page with the error underneath |
2974 | 2981 | if ( $wgUseFileCache ) { |
2975 | 2982 | try { |
2976 | 2983 | $cache = $this->fileCachedPage(); |
— | — | @@ -2984,15 +2991,16 @@ |
2985 | 2992 | '</div>'; |
2986 | 2993 | |
2987 | 2994 | # Output cached page with notices on bottom and re-close body |
2988 | | - return "{$cache}<hr />$text<hr />$extra</body></html>"; |
| 2995 | + echo "{$cache}<hr />{$this->getHTML()}</body></html>"; |
| 2996 | + return; |
2989 | 2997 | } |
2990 | 2998 | } catch ( MWException $e ) { |
2991 | 2999 | // Do nothing, just use the default page |
2992 | 3000 | } |
2993 | 3001 | } |
2994 | 3002 | |
2995 | | - # Headers needed here - output is just the error message |
2996 | | - return $this->htmlHeader() . "$text<hr />$extra" . $this->htmlFooter(); |
| 3003 | + # We can't, cough and die in the usual fashion |
| 3004 | + return parent::reportHTML(); |
2997 | 3005 | } |
2998 | 3006 | |
2999 | 3007 | function searchForm() { |
— | — | @@ -3049,10 +3057,6 @@ |
3050 | 3058 | return ''; |
3051 | 3059 | } |
3052 | 3060 | } |
3053 | | - |
3054 | | - function htmlBodyOnly() { |
3055 | | - return true; |
3056 | | - } |
3057 | 3061 | } |
3058 | 3062 | |
3059 | 3063 | /** |
Index: trunk/phase3/index.php |
— | — | @@ -170,6 +170,10 @@ |
171 | 171 | : 'http://upload.wikimedia.org/wikipedia/commons/1/1c/MediaWiki_logo.png'; |
172 | 172 | |
173 | 173 | header( $_SERVER['SERVER_PROTOCOL'] . ' 500 MediaWiki configuration Error', true, 500 ); |
| 174 | + header( 'Content-type: text/html; charset=UTF-8' ); |
| 175 | + // Don't cache error pages! They cause no end of trouble... |
| 176 | + header( 'Cache-control: none' ); |
| 177 | + header( 'Pragma: nocache' ); |
174 | 178 | |
175 | 179 | ?> |
176 | 180 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |