soyturk / minify

Automatically exported from code.google.com/p/minify
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

groupsConfig.php comment follows bad practice of using create_function() for minifier #138

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Minify version: 2.1.3
PHP version: 5.2.9-1nmm1

What steps will reproduce the problem?
1. Clear Cache from FTP
2. Visit Site -> New Cache files are created
3. Ctrl + F5 -> New Cache files again, old ones are kept.

This leads to a Cache directory filled up with the same files multiple times.

Expected output: Cache Files are created once for each File or Group

Actual output: For every new Request with Response 200 a new Cache File is
created

Additional Information: Smarty and Minify share the same Cache Directory

Greetings from Germany

Original issue reported on code.google.com by cg1...@gmail.com on 20 Sep 2009 at 6:02

GoogleCodeExporter commented 9 years ago
Cache IDs are a digest of the following:

$options['minifiers'] 
$options['minifierOptions']
$options['postprocessor']
$options['bubbleCssImports']
and for each source:
   id (filename)
   minifier (usually null)
   minifyOptions (has the directory of CSS files, usually null for JS files)

So if there's any change to one of the source's location/name, options, or 
global 
options, you'll get different cache IDs.

Does your server have load balancing where DOCUMENT_ROOT changes on different 
requests? If you had 3 internal servers, you'd get 3 different cache IDs.

Original comment by mrclay....@gmail.com on 20 Sep 2009 at 9:51

GoogleCodeExporter commented 9 years ago
Hi,

no load balancing or other fancy stuff used here,
its a very simple setup.

This is my Groups Setup:
return array(
    'mainjs' => array(
        new Minify_Source(array(
            'filepath' => '//js/jquery-1.3.2.min.js',
            'minifier' => create_function('$a', 'return $a;')
        )),
        new Minify_Source(array(
            'filepath' => '//js/jquery.color.js',
            'minifier' => create_function('$a', 'return $a;')
        )),
        new Minify_Source(array(
            'filepath' => '//js/jquery.center.js',
            'minifier' => create_function('$a', 'return $a;')
        )),
        '//js/main.js'),

    'iejs' => array('//js/ie.js'),
    'maincss' => array('//css/main.css'),
    'ie6css' => array('//css/ie6.css')
);

Could it be because of the create_function part?
What is the right way to include a already minified file?

Greetings

Original comment by cg1...@gmail.com on 21 Sep 2009 at 11:13

GoogleCodeExporter commented 9 years ago
Yes, create_function creates a unique internal function name that probably 
exists in 
the serialization.

You want: 'minifier' => ''

See: http://code.google.com/p/minify/wiki/CustomSource

Original comment by mrclay....@gmail.com on 21 Sep 2009 at 2:34

GoogleCodeExporter commented 9 years ago
Okay thank you

I found the create_function Example somewhere on this Page.

Original comment by cg1...@gmail.com on 21 Sep 2009 at 4:31

GoogleCodeExporter commented 9 years ago
If it was on the wiki I think I've removed it in a recent cleanup. I made a 
note 
about create_function on the CustomSource page.

Original comment by mrclay....@gmail.com on 21 Sep 2009 at 4:59

GoogleCodeExporter commented 9 years ago
Yeah nice :)

Its working great ;)

Thank you very much for your work.

Original comment by cg1...@gmail.com on 21 Sep 2009 at 10:19

GoogleCodeExporter commented 9 years ago
Oops. You got the idea for "create_function" from a commented out example in 
2.1.3 
grouspConfig.php. I'll rewrite/remove this comment in the next release.

Original comment by mrclay....@gmail.com on 12 Oct 2009 at 11:24

GoogleCodeExporter commented 9 years ago

Original comment by mrclay....@gmail.com on 4 Sep 2011 at 12:48