From 0c33345146fc6cfb05b25614d923b875cc4cfd5b Mon Sep 17 00:00:00 2001 From: Christian Aistleitner Date: Sun, 15 Apr 2012 20:59:07 +0200 Subject: [PATCH] fwriting to STDOUT -> print in Maintenance Change-Id: I50dec90893a5dc88a5deabcc05a8c32058aca4c8 --- maintenance/Maintenance.php | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 5d76cdffb8..ae1367b0f5 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -320,11 +320,7 @@ abstract class Maintenance { } if ( $channel === null ) { $this->cleanupChanneled(); - if( php_sapi_name() == 'cli' ) { - fwrite( STDOUT, $out ); - } else { - print( $out ); - } + print( $out ); } else { $out = preg_replace( '/\n\z/', '', $out ); $this->outputChanneled( $out, $channel ); @@ -358,11 +354,7 @@ abstract class Maintenance { */ public function cleanupChanneled() { if ( !$this->atLineStart ) { - if( php_sapi_name() == 'cli' ) { - fwrite( STDOUT, "\n" ); - } else { - print "\n"; - } + print "\n"; $this->atLineStart = true; } } @@ -381,31 +373,17 @@ abstract class Maintenance { return; } - $cli = php_sapi_name() == 'cli'; - // End the current line if necessary if ( !$this->atLineStart && $channel !== $this->lastChannel ) { - if( $cli ) { - fwrite( STDOUT, "\n" ); - } else { - print "\n"; - } + print "\n"; } - if( $cli ) { - fwrite( STDOUT, $msg ); - } else { - print $msg; - } + print $msg; $this->atLineStart = false; if ( $channel === null ) { // For unchanneled messages, output trailing newline immediately - if( $cli ) { - fwrite( STDOUT, "\n" ); - } else { - print "\n"; - } + print "\n"; $this->atLineStart = true; } $this->lastChannel = $channel; -- 2.20.1