X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fminify.php;h=540a4d90225cb64fc1223a43405fc8d32ac0d6bd;hb=11dbd4ec8e17bc34070ab2f72cc2535d3f9d5464;hp=c357eebea3bab4894f0b6a9d307691024b591f6d;hpb=1271bb75c60f98720a24ed1bac13a48f2181fb00;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/minify.php b/maintenance/minify.php index c357eebea3..540a4d9022 100644 --- a/maintenance/minify.php +++ b/maintenance/minify.php @@ -40,21 +40,20 @@ class MinifyScript extends Maintenance { "Directory for output. If this is not specified, and neither is --outfile, then the\n" . "output files will be sent to the same directories as the input files.", false, true ); - $this->mDescription = "Minify a file or set of files.\n\n" . + $this->addDescription( "Minify a file or set of files.\n\n" . "If --outfile is not specified, then the output file names will have a .min extension\n" . - "added, e.g. jquery.js -> jquery.min.js."; + "added, e.g. jquery.js -> jquery.min.js." + ); } public function execute() { if ( !count( $this->mArgs ) ) { - $this->error( "minify.php: At least one input file must be specified." ); - exit( 1 ); + $this->fatalError( "minify.php: At least one input file must be specified." ); } if ( $this->hasOption( 'outfile' ) ) { if ( count( $this->mArgs ) > 1 ) { - $this->error( '--outfile may only be used with a single input file.' ); - exit( 1 ); + $this->fatalError( '--outfile may only be used with a single input file.' ); } // Minify one file @@ -76,7 +75,7 @@ class MinifyScript extends Maintenance { } if ( !file_exists( $inPath ) ) { - $this->error( "File does not exist: $arg", true ); + $this->fatalError( "File does not exist: $arg" ); } $extension = $this->getExtension( $inName ); @@ -94,8 +93,7 @@ class MinifyScript extends Maintenance { public function getExtension( $fileName ) { $dotPos = strrpos( $fileName, '.' ); if ( $dotPos === false ) { - $this->error( "No file extension, cannot determine type: $fileName" ); - exit( 1 ); + $this->fatalError( "No file extension, cannot determine type: $fileName" ); } return substr( $fileName, $dotPos + 1 ); @@ -107,13 +105,11 @@ class MinifyScript extends Maintenance { $inText = file_get_contents( $inPath ); if ( $inText === false ) { - $this->error( "Unable to open file $inPath for reading." ); - exit( 1 ); + $this->fatalError( "Unable to open file $inPath for reading." ); } $outFile = fopen( $outPath, 'w' ); if ( !$outFile ) { - $this->error( "Unable to open file $outPath for writing." ); - exit( 1 ); + $this->fatalError( "Unable to open file $outPath for writing." ); } switch ( $extension ) {