[Rt-commit] rt branch, no-prototype, updated. rt-3.8.8-191-gbfa9b90

? sunnavy sunnavy at bestpractical.com
Fri Jul 30 04:16:12 EDT 2010


The branch, no-prototype has been updated
       via  bfa9b90bbead91d3a7b3b2069b84a8b29feac64a (commit)
      from  9443228340be9f8ee2c64ac9b2fce33a9822f134 (commit)

Summary of changes:
 share/html/NoAuth/js/dhandler |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

- Log -----------------------------------------------------------------
commit bfa9b90bbead91d3a7b3b2069b84a8b29feac64a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jul 30 16:18:03 2010 +0800

    only try to load JavaScript::Minifier when jsmin binary fails

diff --git a/share/html/NoAuth/js/dhandler b/share/html/NoAuth/js/dhandler
index 07ce00d..cdcaef1 100644
--- a/share/html/NoAuth/js/dhandler
+++ b/share/html/NoAuth/js/dhandler
@@ -62,19 +62,12 @@ if ( $arg =~ m{squished\.js$} ) {
             $has_jsmin = 1;
         }
 
-        my $has_jsmin_module;
-        eval { require JavaScript::Minifier };
-        if ($@) {
-            $RT::Logger->debug("can't load JavaScript::Minifier: $@");
-        }
-        else {
-            $has_jsmin_module = 1;
-        }
-
         require File::Spec;
         my @js =
           qw/jquery-1.4.2.min.js jquery_noconflict.js jquery.autocomplete-min.js jquery-ui-1.7.3.custom.min.js jquery.timepickr.js titlebox-state.js util.js/;
 
+        my $has_jsmin_module;
+
         for my $js (@js) {
             my $file = File::Spec->catfile( $path, $js );
             my $input = $m->scomp($file);
@@ -102,7 +95,18 @@ if ( $arg =~ m{squished\.js$} ) {
                 }
             }
 
-            if ( $has_jsmin_module ) {
+            unless ( defined $has_jsmin_module ) {
+                eval { require JavaScript::Minifier };
+                if ($@) {
+                    $RT::Logger->debug("can't load JavaScript::Minifier: $@");
+                    $has_jsmin_module = 0;    # don't try again
+                }
+                else {
+                    $has_jsmin_module = 1;
+                }
+            }
+
+            if ($has_jsmin_module) {
                 $content .= JavaScript::Minifier::minify( input => $input );
                 next;
             }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list