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.

Comments

kkaefer’s picture

Status: Active » Postponed (maintainer 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.

haggan’s picture

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?

haggan’s picture

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?

kkaefer’s picture

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.

haggan’s picture

PHP Version 5.2.6
Running on
Scientific Linux SL 5.1

2.6.18-53.1.14.el5

kkaefer’s picture

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.

jcmarco’s picture

Hi,
I had problems with the compression feature. Giving an error about directories.
I found the bug in the sf_cache.admin.inc in the sf_cache_compress function:
Original one:
$temp_path = file_directory_temp() . md5(microtime()) .'.'. $kind;

The problem is with the drupal function file_directory_temp() that returns the path without / and then the file name constructed is tmpxxxxxxx.js, so Drupal gives a write error trying to save it in the drupal root instead the tmp directory.

The right function just need to add the / and then have a good file name to start compressing:

$temp_path = file_directory_temp() .'/'. md5(microtime()) .'.'. $kind;

Congratulations for the module!!

haggan’s picture

Status: Postponed (maintainer needs more info) » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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