r102276 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102275‎ | r102276 | r102277 >
Date:11:25, 7 November 2011
Author:hashar
Status:ok
Tags:
Comment:
streamError now reuses Outputpage

StreamError was reimplementing HTTP Error code already available in
includes/lib/httpstatus.php . So we are now reusing the code logic from
OutputPage and limit code duplication.
Modified paths:
  • /trunk/extensions/VipsScaler/SpecialVipsTest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/VipsScaler/SpecialVipsTest.php
@@ -278,17 +278,15 @@
279279 }
280280 }
281281
 282+
 283+ /**
 284+ * Generates a blank page with given HTTP error code
 285+ *
 286+ * @param $code Integer: HTTP error either 404 or 500
 287+ */
282288 protected function streamError( $code ) {
283 - $this->getOutput()->disable();
284 -
285 - if ( $code == 404 ) {
286 - $msg = 'Not Found';
287 - } elseif ( $code == 500 ) {
288 - $msg = 'Internal Server Error';
289 - }
290 - header( "HTTP/1.0 $code $msg" );
291 - echo "<h1>$msg</h1>\r\n";
292 -
 289+ $this->getOutput()->setStatusCode( $code );
 290+ $this->getOutput()->setArticleBodyOnly( true );
293291 }
294292
295293 }

Status & tagging log