From e3dc74eef6b2671fb2f398d170414fe30464f5d7 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 10 Jan 2014 16:08:13 +0000 Subject: [PATCH] enabling minifying of javascript again and added new option to debug concatination by setting debug flag for minify --- admin/templates/default/config.tpl | 1 + phpgwapi/inc/class.egw_framework.inc.php | 25 ++++++++++++++---------- phpgwapi/inc/min/config.php | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/admin/templates/default/config.tpl b/admin/templates/default/config.tpl index 11aa716c02..7c1f683162 100644 --- a/admin/templates/default/config.tpl +++ b/admin/templates/default/config.tpl @@ -341,6 +341,7 @@ diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index 45b2671751..0b6f99a80f 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -1033,19 +1033,19 @@ abstract class egw_framework // add all css files from self::includeCSS $max_modified = 0; - $debug_minify = (bool)$GLOBALS['egw_info']['server']['debug_minify']; + $debug_minify = $GLOBALS['egw_info']['server']['debug_minify'] === 'True'; $base_path = $GLOBALS['egw_info']['server']['webserver_url']; if ($base_path[0] != '/') $base_path = parse_url($base_path, PHP_URL_PATH); - $css_file = ''; + $css_files = ''; foreach(self::$css_include_files as $n => $path) { foreach(self::resolve_css_includes($path) as $path) { if (($mod = filemtime(EGW_SERVER_ROOT.$path)) > $max_modified) $max_modified = $mod; - if ($debug_minify) + if ($debug_minify || substr($path, -8) == '/app.css') // do NOT include app.css, as it changes from app to app { - $css_file .= ''."\n"; + $css_files .= ''."\n"; } else { @@ -1057,12 +1057,14 @@ abstract class egw_framework { $css = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/inc/min/?'; if ($base_path && $base_path != '/') $css .= 'b='.substr($base_path, 1).'&'; - $css .= 'f='.$css_file . '&'.$max_modified; - $css_file = ''."\n"; + $css .= 'f='.$css_file . + ($GLOBALS['egw_info']['server']['debug_minify'] === 'debug' ? '&debug' : ''). + '&'.$max_modified; + $css_files = ''."\n".$css_files; } return array( 'app_css' => $app_css, - 'css_file' => $css_file, + 'css_file' => $css_files, ); } @@ -1596,7 +1598,7 @@ abstract class egw_framework static public function get_script_links($return_pathes=false, $clear_files=false) { // RB: disabled minifying (debug=true), 'til I found time to fix it - $debug_minify = true;//(bool)$GLOBALS['egw_info']['server']['debug_minify']; + $debug_minify = $GLOBALS['egw_info']['server']['debug_minify'] === 'True'; $files = ''; $to_include = $to_minify = array(); $max_modified = 0; @@ -1607,7 +1609,8 @@ abstract class egw_framework if (($mod = filemtime(EGW_SERVER_ROOT.$path)) > $max_modified) $max_modified = $mod; // for now minify does NOT support query parameters, nor php files generating javascript - if ($debug_minify || $query || substr($path, -3) != '.js' || strpos($path,'ckeditor') !== false) + if ($debug_minify || $query || substr($path, -3) != '.js' || strpos($path,'ckeditor') !== false || + substr($path, -7) == '/app.js') // do NOT include app.js, as it changes from app to app { $path .= '?'. $mod.($query ? '&'.$query : ''); $to_include[] = $path; @@ -1622,7 +1625,9 @@ abstract class egw_framework $base_path = $GLOBALS['egw_info']['server']['webserver_url']; if ($base_path[0] != '/') $base_path = parse_url($base_path, PHP_URL_PATH); $path = '/phpgwapi/inc/min/?'.($base_path && $base_path != '/' ? 'b='.substr($base_path, 1).'&' : ''). - 'f='.implode(',', $to_minify) . '&'.$max_modified; + 'f='.implode(',', $to_minify) . + ($GLOBALS['egw_info']['server']['debug_minify'] === 'debug' ? '&debug' : ''). + '&'.$max_modified; // need to include minified javascript before not minified stuff like jscalendar-setup, as it might depend on it array_unshift($to_include, $path); } diff --git a/phpgwapi/inc/min/config.php b/phpgwapi/inc/min/config.php index 276e61a932..490c312716 100755 --- a/phpgwapi/inc/min/config.php +++ b/phpgwapi/inc/min/config.php @@ -36,7 +36,7 @@ $min_errorLogger = false; * In 'debug' mode, Minify combines files with no minification and adds comments * to indicate line #s of the original files. */ -$min_allowDebugFlag = false; +$min_allowDebugFlag = true; /**