From b91643ffdcd1d44340137fc9c6fdf3c01d47581b Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Wed, 30 Sep 2015 13:39:20 -0700 Subject: [PATCH] resourceloader: Deprecate two pointless minification config vars When minifying JavaScript, never put each statement on a separate line, and always set a target maximum line length of 1000. These behaviors were previously configurable via $wgResourceLoaderMinifierStatementsOnOwnLine and $wgResourceLoaderMinifierMaxLineLength, respectively. Change-Id: I0b0eb632875b5e16f728fd0aa62f7f5ecd79ef62 --- RELEASE-NOTES-1.27 | 4 ++++ includes/DefaultSettings.php | 4 ++++ includes/resourceloader/ResourceLoader.php | 5 +---- maintenance/minify.php | 13 +------------ 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/RELEASE-NOTES-1.27 b/RELEASE-NOTES-1.27 index bf50a4740a..eb154396f3 100644 --- a/RELEASE-NOTES-1.27 +++ b/RELEASE-NOTES-1.27 @@ -10,6 +10,10 @@ production. === Configuration changes in 1.27 === * Removed $wgUseLinkNamespaceDBFields +* Deprecated $wgResourceLoaderMinifierStatementsOnOwnLine and + $wgResourceLoaderMinifierMaxLineLength, because there was little value in + making the behavior configurable. The default values (`false` for the former, + 1000 for the latter) are now hard-coded. === New features in 1.27 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 3a37a71cee..69b4a24b88 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3523,6 +3523,8 @@ $wgResourceLoaderDebug = false; /** * Put each statement on its own line when minifying JavaScript. This makes * debugging in non-debug mode a bit easier. + * + * @deprecated since 1.27: Always false; no longer configurable. */ $wgResourceLoaderMinifierStatementsOnOwnLine = false; @@ -3530,6 +3532,8 @@ $wgResourceLoaderMinifierStatementsOnOwnLine = false; * Maximum line length when minifying JavaScript. This is not a hard maximum: * the minifier will try not to produce lines longer than this, but may be * forced to do so in certain cases. + * + * @deprecated since 1.27: Always 1,000; no longer configurable. */ $wgResourceLoaderMinifierMaxLineLength = 1000; diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 833fc8848d..4cec7ef0b8 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -246,10 +246,7 @@ class ResourceLoader implements LoggerAwareInterface { private static function applyFilter( $filter, $data, Config $config ) { switch ( $filter ) { case 'minify-js': - return JavaScriptMinifier::minify( $data, - $config->get( 'ResourceLoaderMinifierStatementsOnOwnLine' ), - $config->get( 'ResourceLoaderMinifierMaxLineLength' ) - ); + return JavaScriptMinifier::minify( $data ); case 'minify-css': return CSSMin::minify( $data ); } diff --git a/maintenance/minify.php b/maintenance/minify.php index efecaad0d0..c357eebea3 100644 --- a/maintenance/minify.php +++ b/maintenance/minify.php @@ -40,12 +40,6 @@ 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->addOption( 'js-statements-on-own-line', - "Boolean value for putting statements on their own line when minifying JavaScript.", - false, true ); - $this->addOption( 'js-max-line-length', - "Maximum line length for JavaScript minification.", - false, true ); $this->mDescription = "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."; @@ -108,8 +102,6 @@ class MinifyScript extends Maintenance { } public function minify( $inPath, $outPath ) { - global $wgResourceLoaderMinifierStatementsOnOwnLine, $wgResourceLoaderMinifierMaxLineLength; - $extension = $this->getExtension( $inPath ); $this->output( basename( $inPath ) . ' -> ' . basename( $outPath ) . '...' ); @@ -126,10 +118,7 @@ class MinifyScript extends Maintenance { switch ( $extension ) { case 'js': - $outText = JavaScriptMinifier::minify( $inText, - $this->getOption( 'js-statements-on-own-line', $wgResourceLoaderMinifierStatementsOnOwnLine ), - $this->getOption( 'js-max-line-length', $wgResourceLoaderMinifierMaxLineLength ) - ); + $outText = JavaScriptMinifier::minify( $inText ); break; case 'css': $outText = CSSMin::minify( $inText ); -- 2.20.1