Release Notes

!!IMPORTANT!!

Some of Elggs core plugins don't function properly due to the fact that their page handler functions aren't returning the correct values. For a list of patches please read this document. If anyone else finds a plugin that is conflicting with Compactor please let me know and I'll update the list.

What Am I?

The compactor does several things, mostly it just applies YSlow's recommendations to any outputted content. It caches css, javascript and dynamic images (gif, jpeg and pngs). Each cached item means it doesn't have to be regenerated freeing up a lot of resources. At the moment because each file is cached based on "md5($_SERVER['PHP_SELF'].$_SERVER['QUERY_STRING'])" the caching is permanent until the cache directory is cleared (automatically in hourly, weekly, monthly intervals etc).

It doesn't just free up server resources with the caching but also speeds up delivery of the page to the browser with it's white space stripping and defalting (gzip) methods. It also searches for any external js sources and then collects them all into one resource so instead of loading 3-4 js files it loads 1. If the js file can't be combined with others (ie if it is server dynamically through php) it  leaves it alone, but the output of the dynamic js is still compacted, deflated and cached all the same. The same method is applied with css.

It can also perform other functions such as moving all the discovered css to just below the opening <head> tag and the js to just above the closing </body> tag for optimisation purposes, but they are rather superfluous and I coded them just for shits and giggles.

The basic results of the whole plugin shrink the required output of one Elgg page load from 300kb to 44kb, then with the etag and last-modified headers a page can load in as little as 2kb. Vastly speeding up the delivery, saving 298kb in bandwidth (saving an estimated 1.5GB per day based on 5 (max) page loads per second over 24 hours).

So as you can see, it may well be worth installing this one.

(Note: all the above mentioned settings are configurable in the plugins' admin panel)

Updates

- Fixes an IE6 CSS issue.
- Disables compactor usage if the plugin is enabled but none of the options are.

Previous Versions

2.1.4
2.1.3

2.1.2

2.1.1
2.1.0
2.0.0.b
1.0.0

  • @gary : try this one, I've checked it in Windows and it works now.

    @Tom : you sure caching is turned on in the admin?

  • yes, oliver, all is on.

    I tried Firebug:

    Cleaned cache repository. Files removed = 0 (0.672472000122)
    Checking server cache...
    ...looking for cache, cache id = 68951ec0bac1d2c715bbb33ebd6ef786
    ...no cache exists. :-( (0.00281000137329)
    Checking browser cache...
    ...the output is not cached in the browser :-( (0.00257396697998)
    Processing HTML...
    ...will compact inline CSS
    ...will compact inline Javascript
    ...compacting
    ...found 3 css style declarations
    ...joining inline css
    ...joined 0 css declarations
    ...found 1 css links
    ...joining external css
    ...joined 0 css links
    ...moving css items
    ...moved 2 css items
    ...removing 3 unrequired css items
    ...inline css optimisation complete (0.00998592376709)
    ...found 5 javascript elements
    ...joining inline javscript
    ...joined 1 javascript declarations
    ......adding "vendors/jquery/jquery-1.2.6.pack.js" to javascript join
    ......adding "vendors/jquery/jquery-ui-personalized-1.5.packed.js" to javascript join
    ...joined 2 external javascript sources
    ...moving javascript items
    ...moved 2 javascript items
    ...removing 6 un-required javascript items
    ...inline javascript optimisation complete (0.00997400283813)
    ...deflated (0.00369119644165)
    Cleaned cache repository. Files removed = 0 (0.288985013962)
    Checking server cache...
    ...looking for cache, cache id = 2dd35f1fc000a882865fa09730d5cdf4
    ...no cache exists. :-( (0.00292205810547)
    Checking browser cache...
    ...the output is not cached in the browser :-( (0.00296306610107)
    !! Found other content type: image/jpeg, perhaps we should use compactor to cache these?
    Cleaned cache repository. Files removed = 0 (0.362668991089)
    Checking server cache...
    ...looking for cache, cache id = d1fdd0df488f46c85d3b89b0e61ae12b
    ...no cache exists. :-( (0.00213599205017)
    Checking browser cache...
    ...the output is not cached in the browser :-( (0.00277400016785)
    !! Found other content type: text/css, perhaps we should use compactor to cache these?
  • not quite sure what to say. it works fine for me. It seems as if your compactor isn't trying to cache the data at all. Are you sure this option is turned on in the admin?

    Also you should re-add the powered-by elgg notice at the bottom.

  • All options are enabled, noting disabled. However, last try did generate some cache files, but the thing went bizarrly slow (51"/page) and uses one image for all file thumbnails, instead of each a seperate...  mmm, I will play with it some more today or revert back to 2.0

    (Off topic: the sponsor does not allow other logo's (period.). Still I like to find a way to credit the various open source platforms we use: elgg, mediawiki, SMF board, phpfreechat, MODx. Trouble is we all mix on one page, and that does not even count the plugins like Tiny... well, we go life in 6 months or so;) )

  • Tried again in full, this is what I did:
    - Download new 2.1.5 ZIP from above
    - Delete mod/compactor folder on site
    - add your htaccess_additions to bottom of my .htaccess
    - Unzip local and upload
    - Set mod/compactor/cache folder to 777
    - Enable Tools/Compactor in site
    - Tools/Compactor/more info:  Enabled Cache (no other options checked so far!)
    - Problem! File widget thumbnails all show same thumbnail instead of for each file differently ??? 

    hmm... maybe I should disable all other tools now? Is it an .htaccess issue maybe?

  • With regards to the logo removal, you should check with Elgg that this is ok, I think it may break one of the opensource terms and conditions unless you have a agreement with them.

    The image thing I've not seen myself but have heard it happens. I will look at it today and see why this is happening

  • All Thumbnails of File plugin get same Etag! Path is ok and different for each. Yslow  complains these .jpg's not have a far future Expires, although imo they should match the .htaccess <FilesMatch "\.(jpg|  ...??

    Others now function fine. I assume the problem was when updating from 2.0 to 2.1.5, first attempt I did not delete whole dir, but overwrote it. Also found that everytime clearing cache before sumitting compactor's changes seems good idea

  • Tom,

    There is one thing to change in the compactor to create a far future expires for dynamic assets and that is to change line#724 in start.php to

                'maxAge' => 31536000

    I will change it in another update shortly. As for the htaccess rules, you might not have mod_expires in your apache setup as it is not there by default.

  • Tom, it sounds like a good plugin, but I've followed the instruction and when I set the settings to enabled, nothing happens and when I came back to the settings, everything comes back to 'disabled'.

    How do I know if it's working? seems like the '$COMPACTOR_SETTINGS' are never set.

    Thanks

  • Does this plugin work with Elgg 1.2? What kind of performance improvements does it add for 1.2?

  • Iam experiencing the same problems with elgg core 1.2 ... does there exist any kind of patch?

  • The plugin doesn't work indeed. No settings are set in admin panel, there are all the time disable. More, cache is not saving in catalog...how to cause it will work well?

    This plugin is very useful...with out it elgg runs very slow. Please give us some information how to cope with it.

    Thanks

  • @Olivier 

    Are you finished to develop this plugin? For 1.5 for example. It's very useful. 

  • I haven't been working on Elgg recently. I imagine it wouldn't take that much to fix it but I just haven't had the time to work on my Elgg project as of late. If someone wants to take over the plugin feel free to ask.

  • I'm sorry but I do not have the time nor the inclanation at the moment. I am open to paid support requests though.

  • I just tried this plugin out.. does nothing???????

Stats

  • Category: Uncategorized
  • License: Modified BSD license
  • Updated: 2014-11-17
  • Downloads: 4678
  • Recommendations: 2

Other Projects

View Oliver Lillie's plugins