YUI

haggan - May 7, 2008 - 19:49
Project:Support file Cache
Version:5.x-1.1-a
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active (needs more info)
Description

I am trying to use the third party yuicompressor-2.3.5.jar.

I have shell acces to the server and I can see that java is running but none of the bundles or the stand alone .js seems to be changed.
when I run java -jar sites/all/modules/sf_cache/bin/yuicompressor-2.3.5.jar --nomunge xxx.js it seems to work just fine.

I dont get any error at all what I can see.

Also I found a way to use this with private download is to have drupale files outside of www-root and create symlink in a dir inside root, and then write in that path as an "external" server.

#1

kkaefer - May 7, 2008 - 20:47
Status:active» active (needs more info)

Can you please post the configuration details and how you set this up? It's difficult to draw any conclusions from what you posted.

#2

haggan - May 8, 2008 - 07:31

Installed module per instruction. And enabled.
using private download out side of site-root

ex.

Drupal root: /var/www/site-root
files root: /var/www/drupal-files
sf_js: /var/www/drupal-files/sf_js
same for css.

then I have the old public files dir on /var/www/site-root/files
i created two symlinks in that dir

so that /var/www/site-root/files/sf_js -> /var/www/drupal-files/sf_js
and sf_js->/var/www/drupal-files/sf_css

then In support file configuration -> path wrote down the url directly to www.deg.com/files/sf_js
It working great and I have no problmes loading css or js in that way.

I downloaded and install YUI in sites/all/modules/sf_cache/bin/yuicompressor-2.3.5.jar

using
Executable:
java -jar sites/all/modules/sf_cache/bin/yuicompressor-2.3.5.jar

Parameters:
--nomunge

When I press save I can see when running "top" on my server that java is running and httpd is using the cpu. And all the files got new names and time stamp but no compression.

If i run java -jar sites/all/modules/sf_cache/bin/yuicompressor-2.3.5.jar --nomunge xxx.js on the server the output looks nice and compressed.

The buillt in CSS compressor is working.

Do you need anything more?

#3

haggan - May 8, 2008 - 20:25

I have done a lot of strace on httpd

And also print out on the $cmd in the php code

the cmd line is:

java -jar /var/www/web/spexet.nu/sites/all/modules/sf_cache/bin/yuicompressor-2.3.5.jar '--nomunge /var/www/web/filer_spexet_drupal/tmpcabf5e952b6c50248ed685a502a1cf2f.js'

I have found this in strace on httpd:

execve("/bin/sh", ["sh", "-c", "java -jar /var/www/web/spexet.nu/sites/all/modules/sf_cache/bin/yuicompressor-2.3.5.jar \'--nomunge /var/www/web/filer_spexet_drupal/tmp28ea08889979debd65e70516686bbaa4.js\'"], [/* 17 vars */]) = 0

the ' is escaped to \' and that dosent fly on my server. And it happens in the $processed = exec($cmd, $return, $status); I think
I have change the cmd line to
$cmd = escapeshellcmd($exec) .' '. preg_replace('/\\r|\\n/', ' ', $params) .' '. $temp_path;
deleting the escapeshellarg() and the java is running now. And the bundles are compressed

Is this a bug or just something fishy on my server?

#4

kkaefer - May 8, 2008 - 21:35

Ok, looks like you found the reason... However, the compression works for me with that escapeshellarg() both on Mac OS X and on Ubuntu. What PHP version are you running? It might be related to that.

#5

haggan - May 9, 2008 - 05:02

PHP Version 5.2.6
Running on
Scientific Linux SL 5.1

2.6.18-53.1.14.el5

#6

kkaefer - May 9, 2008 - 15:04

Ok, I reviewed the shell command execution code and changed the way the parameters are appended a bit. Please try if it works for you now (it really should). You can get an updated version of this module on http://drupal.org/node/223959 (you might have to wait until its regenerated with the updated files from CVS) or checkout the module from CVS directly.

 
 

Drupal is a registered trademark of Dries Buytaert.