Don't use echo in maintenance scripts that extends the Maintenance class
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 11 Sep 2010 14:21:34 +0000 (14:21 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 11 Sep 2010 14:21:34 +0000 (14:21 +0000)
maintenance/minify.php

index 6b94291..5357ff1 100644 (file)
@@ -48,13 +48,12 @@ class MinifyScript extends Maintenance {
                        $inDir = dirname( $inPath );
 
                        if ( strpos( $inName, '.min.' ) !== false ) {
                        $inDir = dirname( $inPath );
 
                        if ( strpos( $inName, '.min.' ) !== false ) {
-                               echo "Skipping $inName\n";
+                               $this->error( "Skipping $inName\n" );
                                continue;
                        }
 
                        if ( !file_exists( $inPath ) ) {
                                continue;
                        }
 
                        if ( !file_exists( $inPath ) ) {
-                               $this->error( "File does not exist: $arg" );
-                               exit( 1 );
+                               $this->error( "File does not exist: $arg", true );
                        }
 
                        $extension = $this->getExtension( $inName );
                        }
 
                        $extension = $this->getExtension( $inName );
@@ -80,7 +79,7 @@ class MinifyScript extends Maintenance {
 
        public function minify( $inPath, $outPath ) {
                $extension = $this->getExtension( $inPath );
 
        public function minify( $inPath, $outPath ) {
                $extension = $this->getExtension( $inPath );
-               echo basename( $inPath ) . ' -> ' . basename( $outPath ) . '...';
+               $this->output( basename( $inPath ) . ' -> ' . basename( $outPath ) . '...' );
 
                $inText = file_get_contents( $inPath );
                if ( $inText === false ) {
 
                $inText = file_get_contents( $inPath );
                if ( $inText === false ) {
@@ -103,7 +102,7 @@ class MinifyScript extends Maintenance {
 
                fwrite( $outFile, $outText );
                fclose( $outFile );
 
                fwrite( $outFile, $outText );
                fclose( $outFile );
-               echo " ok\n";
+               $this->output( " ok\n" );
        }
 }
 
        }
 }