Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

en masse head element caching is causing unnecessary code #675

Closed
drewgg opened this issue Dec 27, 2011 · 2 comments
Closed

en masse head element caching is causing unnecessary code #675

drewgg opened this issue Dec 27, 2011 · 2 comments

Comments

@drewgg
Copy link

drewgg commented Dec 27, 2011

I originally brought up this issue on the forums here (gives a description of the issue with some of the files/classes involved): http://forum.joomla.org/viewtopic.php?p=2696622

I was asked to post my finding to an already opened ticket on the CMS tracker here (I posted steps there to reproduce the issue): http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_id=8103&tracker_item_id=27503

There it was suggested that the issue is in the platform and that I should open a ticket here.

Brief Description:
Modules are caching head data unrelated to that module.

More details:

When a module is cached (via JModuleHelper::moduleCache()) JCache::setWorkarounds() will retrieve 10 types of head data from JDocumentHTML (via JDocumentHTML::getHeadData())

JCache will unset 5 of the data types:

JDocumentHTML->title
JDocumentHTML->description
JDocumentHTML->link
JDocumentHTML->_links
JDocumentHTML->_metaTags

and cache the remaining 5 with the module:

JDocumentHTML->_styleSheets
JDocumentHTML->_style
JDocumentHTML->_scripts
JDocumentHTML->_script
JDocumentHTML->_custom

Often most or all of that remaining head data being cached has nothing to do with the module being cached (eg, mod_breadcrumbs may store custom head data added by a Content Plugin). This results in unnecessary code being added to the head which can cause bugs. This isn't noticeable right away because the head data is dedupped at some point, so a script file (for example) being cached in multiple module caches will still only be seen once in the final html source. However, unneeded scrips/styles/etc and data unique to specific pages will start to show up where they don't belong.

Thanks for reading!

@stutteringp0et
Copy link

this is directly related to an issue I submitted:
#673

The issue is not only for modules, but plugins as well. I have modified JS in several of my plugins to detect if they've already been run. This is no good for the output, however, as the head data just gets bigger and bigger.

My question is how to manipulate settings in JCache::setWorkarounds - which could be used t o mitigate this issue in affected modules/plugins.

@eddieajau
Copy link
Contributor

Closing as a duplicate issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants