hi-

the javascript files on my site that compressed using javascript_aggregator do not compress with this module. my css files are getting compressed. am i doing something wrong?

thx!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mudjunky’s picture

i tracked the problem down to one of my js files that javascript_aggregator with jsmin+ enabled shows as "Parse error: Illegal token in file '[inline]' on line 2752 "

i looked in the advagg watchdog to see what the offending file was, but all i got was "Debug info: !data" -- where can i tell what files bombed?

thanks

mikeytown2’s picture

Component: Code » JS Compression

Can I get more details? What files are not getting compressed? Do any get compressed?

mudjunky’s picture

i get a compressed link, but the contents in the file are not compressed. it's just one giant javascript file with the contents of all my javascript files.

mikeytown2’s picture

in your database run this query & paste the output here.

SELECT *
FROM advagg_files
WHERE filetype = 'js'

Looks like I could use an info tab for displaying data like this.

thanks for the heads up with debug not working. committed this patch. it will fix debug but not this issue.

mikeytown2’s picture

i get a compressed link, but the contents in the file are not compressed. it's just one giant javascript file with the contents of all my javascript files.

This is what happens when jsmin+ bombs on a JS file. rather then giving you no JS it gives you the aggregated version. jsmin+ likes to bomb on files that have already been minified. Reminds me, I should minify everything above and below the offending file & include the file, as it is, in the aggregate.

mudjunky’s picture

----------+
| filename | data |
+----------------------------------------------------------------+--------------------------------------------------------------------------------+
| sites/all/modules/jquery_update/replace/jquery.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| misc/drupal.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/modules/fb/fb_connect.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/modules/fb/fb_stream.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/modules/fb/fb.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/modules/fivestar/js/fivestar.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/modules/flag_friend/flag_friend.popups.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/modules/lightbox2/js/auto_image_handling.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/modules/lightbox2/js/lightbox.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/modules/swfobject/swfobject/src/swfobject.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/modules/admin_menu/admin_menu.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/modules/popups/popups.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| themes/garland/popups-skin.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| misc/tableheader.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| misc/collapse.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/modules/jquery_update/replace/jquery.form.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| misc/textarea.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/themes/custom/popups-skin.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/modules/flag/theme/flag.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/themes/custom/js/base.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/themes/custom/js/jquery.tooltip.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/modules/views/js/base.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
| sites/all/modules/views/js/ajax_view.js | a:1:{s:18:"advagg_js_compress";a:1:{s:6:"tested";a:1:{s:9:"jsminplus";i:-1;}}} |
+----------------------------------------------------------------+--------------------------------------------------------------------------------+

mudjunky’s picture

ok thanks for the head's up. great idea on above/below. i want to find this pesky file!

mikeytown2’s picture

FileSize
963 bytes

hmmm they are all -1. Looks like this bit of code is not working on your server. Sounds like I need to test it first before relying on it and have this on the status page.

...
    // Setup request URL and headers.
    $query['values'] = $info;
    $query['key'] = $key;
    $query_string = http_build_query($query, '', '&');
    $ip = variable_get('advagg_server_addr', FALSE);
    if (empty($ip)) {
      $ip = $_SERVER['SERVER_ADDR'];
    }
    $url = 'http://' . $ip . $base_path . 'advagg_js_compress_test_file.php';
    $headers = array(
      'Host' => $_SERVER['HTTP_HOST'],
      'Content-Type' => 'application/x-www-form-urlencoded',
    );

    $results = drupal_http_request($url, $headers, 'POST', $query_string);
    $data = advagg_get_file_data($info['md5']);
    if ($results->data == $info['md5']) {
      $data['advagg_js_compress']['tested']['jsminplus'] = 1;
    }
    else {
      $data['advagg_js_compress']['tested']['jsminplus'] = -1;
      $bad_files[] = $info;
    }
    advagg_set_file_data($info['md5'], $data);
...

What this does is issue a POST to the menu_callback for advagg_js_compress_test_file.php. I like to name most callbacks .php as that allows one to swap in a php file for faster performance. If I test the file in this process, odds are it will kill PHP if jsmin+ fails. Thus I test in another process and test the return value. If return value doesn't match then I assume jsmin+ failed on that file.

I did fix a bug in here, but sadly this bug wouldn't be fixing your issue. Patch attached.

mikeytown2’s picture

BTW what does your status page say in regards to AdvAgg?

mudjunky’s picture

man you're on it.

mudjunky’s picture

Status page has an error: Adv CSS/JS Agg - Asynchronous Mode Set to FALSE.

i have this code snippet at the bottom of settings.php. i still get the status error if i remove it. (no other fast 404's on my setup that i know of.)

// List of extensions for static files
$exts = 'txt|png|gif|jpe?g|shtml?|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp|xml';

// It is not an imagecache path, which we allow to go through Drupal
//if (!strpos($_SERVER['QUERY_STRING'], 'imagecache')) {
	// modified for advagg
if (!strpos($_SERVER['QUERY_STRING'], 'imagecache') && !strpos($_SERVER['QUERY_STRING'], '/advagg_')) {
  // It is not our main feed page
  if ($_SERVER['QUERY_STRING'] != 'rss.xml') {
    // Is it a static file? 
    if (preg_match('/\.(' . $exts . ')$/', $_SERVER['QUERY_STRING']))
      // Just send a 404 right now ...
      {
      header('HTTP/1.0 404 Not Found');
      print '<html>';
      print '<head><title>404 Not Found</title></head>';
      print '<body><h1>Not Found</h1>';
      print '<p>The requested URL was not found on this server.</p>';
      print '</body></html>';
      exit();
    }
  }
}
mikeytown2’s picture

Status: Active » Needs work
FileSize
8.97 KB

Still doesn't fix the callback issue but it will now compress the files if it the callback isn't working. In short your back to javascript_aggregator with jsmin+.

Now I need to make it skip bad files.

mikeytown2’s picture

Status: Needs work » Fixed
FileSize
12.53 KB

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Michsk’s picture

Status: Closed (fixed) » Active

I'm not getting this, was this fixed or not, since i'm having the same issue. Can i do something to help testing / reporting?

mikeytown2’s picture

@lasac
The code was committed; but you could have a new issue here. Please provide as much information as possible.

jtsnow’s picture

The patch that I posted here should fix this: http://drupal.org/node/1186106#comment-5059064

Michsk’s picture

First of all my report states:

Adv CSS/JS Agg - Asynchronous Mode Set to FALSE.
Check to see if you have fast 404s, if so create an exception for this module. The readme file explains what needs to be changed. You can try flushing the menu cache as well. If you are still having issues you can go to the AdvAgg information tab and select Asynchronous debug info. If creating an issue on d.o be sure to include this information .

Tough i have made the settings.php changes for the fast 404.

Next up the the info from the advagg information tab:

http://dev.##.nl/sites/default/files/advagg_css/css_missing14740600641318021978_0.css: 
stdClass Object (
    [request] => GET /sites/default/files/advagg_css/css_missing14740600641318021978_0.css HTTP/1.0
Host: dev.##.nl
User-Agent: Drupal (+http://drupal.org/)
Connection: close

    [data] => <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /sites/default/files/advagg_css/css_missing14740600641318021978_0.css
on this server.</p>
<hr>
<address>Apache Server at dev.indepressie.nl Port 80</address>
</body></html>
    [protocol] => HTTP/1.1
    [status_message] => Forbidden
    [headers] => Array (
            [Date] => Fri, 07 Oct 2011 21:12:58 GMT
            [Server] => Apache
            [Vary] => Accept-Encoding
            [Content-Length] => 338
            [Connection] => close
            [Content-Type] => text/html; charset=iso-8859-1
        )
    [error] => Forbidden
    [code] => 403
    [timer] => Array (
            [count] => 1
            [time] => 9.16
        )
)

Here's the result from the querey you asked from the issue starter:

misc/drupal.js,"52ae9b20d07a214cf2b5eb3bbd675899","1292630896","js","9834","0"
sites/default/files/languages/nl_29a5875ce5a9db08be73f18a56683c79.js,"e00ed58472cc0f28c1e58b7aac812d43","1300439941","js","2848","0"
sites/all/modules/fb/fb_connect.js,"18e71a7c9d3f7d8d6fe9c15877cff870","1317626211","js","5027","0"
sites/all/modules/fb/fb_stream.js,"8a8afa659bcc49acdffeb56e4bb83ecd","1317626214","js","565","0"
sites/all/modules/fb/fb.js,"0697f9ad764450a1d9a690d2f21cc7d3","1317626207","js","9034","0"
sites/all/modules/fivestar/js/fivestar.js,"f101be7b608cb433624dd92d5c9f26b5","1317641224","js","16336","0"
sites/all/modules/menu_minipanels/js/menu_minipanels.js,"e7e28921a7fd40fa39112dd5a6b96354","1314715140","js","3275","0"
sites/all/modules/menu_minipanels/js/lib/jquery.qtip-1.0.0-rc3.min.js,"07a1840c5e594b7e92bb8a2189f5bf23","1314730061","js","38404","0"
sites/all/modules/drupal_glue/js/menu.js,"938b1f0bd6580b5ab8c7245fcc23c46d","1314856662","js","163","0"
sites/all/modules/panels/js/panels.js,"cf692d77bebd591019f7ee40b55f8fae","1314621974","js","797","0"
sites/all/modules/poormanscron/poormanscron.js,"72f1ae29f2c0853d1355f2c442e5990d","1293741080","js","598","0"
sites/all/modules/admin/includes/jquery.cookie.js,"12650876c042a4e7b2baf499c222096d","1291592496","js","3937","0"
sites/all/modules/admin/includes/jquery.drilldown.js,"cbb94bee0183d72362fb7f3093476033","1291592496","js","6555","0"
sites/all/modules/admin/includes/admin.toolbar.js,"cbcd07cdc57dfe13869085649bc818b6","1291592496","js","6557","0"
sites/all/modules/admin/includes/admin.menu.js,"91165c4d26d8e3cfbc36ecacfefc53a7","1291592495","js","2288","0"
sites/all/themes/tao/js/tao.js,"2e4d505de78c311d41abe31722e581c6","1291592922","js","773","0"
sites/all/themes/rubik/js/rubik.js,"0251a3f0a6c4685fcd79c5d886c69277","1291592920","js","1350","0"
misc/tableheader.js,"5a115594835451a39fda1a5cb9364e4e","1292630901","js","3858","0"
sites/all/themes/indepressie/js/libs/modernizr-2.0.6.min.js,"4afbde2202ea8bd22da9a3f5a714c541","1314622184","js","16226","0"
sites/all/themes/indepressie/js/libs/offset.js,"95162b64b7c9bc265875d046ebe93e0e","1315911419","js","11397","0"
sites/all/themes/indepressie/js/libs/jquery.stickyscroll.js,"bcdb52dd3de65921265660b293d7b23b","1317374615","js","4415","0"
sites/all/themes/indepressie/js/script.js,"0a00e6571811f28fe34ea04a8da94e7c","1316782498","js","205","0"
sites/all/modules/smileys/scripts/smileys.js,"6d8c28780150e0fcc79e545420283e13","1291592788","js","4373","0"
sites/all/modules/jquery_ui/jquery.ui/ui/minified/ui.core.min.js,"f8438f000e9e4d7c8c26accc4dd7483b","1317839723","js","8092","0"
sites/all/modules/jquery_ui/jquery.ui/ui/minified/ui.dialog.min.js,"d6f56e661fcc6398c1b7cb16f53e6912","1317839723","js","10333","0"
sites/all/modules/jquery_ui/jquery.ui/ui/minified/ui.draggable.min.js,"a72ecc402d82f5013d3e25f87fec4393","1317839723","js","17420","0"
misc/collapse.js,"f88cec77e54915077d9ace48adaf184e","1292630896","js","2669","0"
misc/textarea.js,"19b52b24e89c8212f4f14302eb066356","1292630901","js","1321","0"

The log's dont show any errors. Please let me know what more i can supply.

Also did this:

If this is still an issue you can try setting the
"IP Address to send all asynchronous requests to" setting on the
admin/settings/advagg/config page to -1. This will use the hostname instead of
an IP address when making the http request.

Michsk’s picture

PS; im having this with 6-1.5

//edit: using latest dev didn't fix it.

mikeytown2’s picture

@lasac
Try the dev that will come out in 3 hours.

As for Asynchronous Mode getting that working would be a good idea. Sounds like you restrict access at the apache level; any way to allow advagg through?

Michsk’s picture

Not sure, could you tell me more on how to achieve this?

Got my first error when trying to increment and rebuild aggegrated files

Lokatie	http://dev.###.nl/batch?id=204&op=do
Doorverwijzer	http://dev.###.nl/batch?op=start&id=204
Bericht	Cannot modify header information - headers already sent by (output started at /var/www/vhosts/###.nl/dev/sites/all/modules/advagg/advagg_js_compress/jsminplus.inc:218) in /var/www/vhosts/###.nl/dev/includes/common.inc op regel 148.

//edit: tough refreshing the update page started to update process and did not return a error anymore. Maybe it showed a error the first time because i cleard the advagg cache directly before rebuilding?

Michsk’s picture

I'ts starting to work. Tough my update is stuck on 25%, when i look at a node i see that some js is getting compressed. Drupal for facebook (module) js is not getting compressed.

//edit Another refresh, another header error from jsmin+ in the log, but now it's stuck at 68%

Michsk’s picture

Also rebuilding aggegrated files returns the headers error

Michsk’s picture

Ok everything is getting compressed except the drupal for facebook code. I'll create a new issue.

mikeytown2’s picture

Status: Active » Closed (duplicate)