r56580 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56579‎ | r56580 | r56581 >
Date:04:26, 18 September 2009
Author:tstarling
Status:ok
Tags:
Comment:
Use STDERR instead of fopen('php://stderr') when possible
Modified paths:
  • /trunk/phase3/maintenance/Maintenance.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/Maintenance.php
@@ -225,9 +225,13 @@
226226 * @param $die boolean If true, go ahead and die out.
227227 */
228228 protected function error( $err, $die = false ) {
229 - $f = fopen( 'php://stderr', 'w' );
230 - fwrite( $f, $err . "\n" );
231 - fclose( $f );
 229+ if ( php_sapi_name() == 'cli' ) {
 230+ fwrite( STDERR, $err . "\n" );
 231+ } else {
 232+ $f = fopen( 'php://stderr', 'w' );
 233+ fwrite( $f, $err . "\n" );
 234+ fclose( $f );
 235+ }
232236 if( $die ) die();
233237 }
234238

Status & tagging log