resourceloader: Deprecate two pointless minification config vars
authorOri Livneh <ori@wikimedia.org>
Wed, 30 Sep 2015 20:39:20 +0000 (13:39 -0700)
committerKrinkle <krinklemail@gmail.com>
Wed, 30 Sep 2015 22:04:33 +0000 (22:04 +0000)
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
includes/DefaultSettings.php
includes/resourceloader/ResourceLoader.php
maintenance/minify.php

index bf50a47..eb15439 100644 (file)
@@ -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 ===
 
index 3a37a71..69b4a24 100644 (file)
@@ -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;
 
index 833fc88..4cec7ef 100644 (file)
@@ -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 );
                }
index efecaad..c357eeb 100644 (file)
@@ -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 );