?
avatar joeguo
joeguo
10 Jul 2012

When we enable the system plugin cache enabled, it doesn't work properly with the compojoom comment component.
The newly added comments from the guest doesn't show up until the cached page expired.

After debug and test, we find that Joomla doesn't remove the cached page when received the POST request.

we have fixed this problem in our server with the following method:

in /plugins/system/cache/cache.php 62 lines:
change from:
if ($user->get('guest') && $_SERVER['REQUEST_METHOD'] == 'GET') {
$this->_cache->setCaching(true);
}
to:
if ($user->get('guest') && $_SERVER['REQUEST_METHOD'] == 'GET') {
$this->_cache->setCaching(true);
}else{
$this->_cache->remove();
}

in file /libraries/joomla/cache/controller/page.php change the function
protected function _makeId()
{
return JCache::makeId();
}
to
protected function _makeId()
{
//calculate the cache id according to refer page when post request
$user = JFactory::getUser();
if ($user->get('guest')&& $_SERVER['REQUEST_METHOD'] == 'POST') {
$referer=$_SERVER['HTTP_REFERER'];
if (JURI::isInternal($referer)) {
$referer = '/'.substr($referer, strlen(JURI::base()));
return md5(serialize($referer));
}
}
return JCache::makeId();
}

and add the function:
public function remove(){
$id= $this->_id==null?$this->_makeId():$this->_id;
$group='page';
$this->_id = null;
$this->_group = null;
return $this->cache->remove($id,$group );
}

Hopefully Joomla team can include this fix into the next release.

avatar joeguo joeguo - open - 10 Jul 2012
avatar infograf768
infograf768 - comment - 10 Jul 2012

Please open a tracker on joomalcode and propose a patch with test instructions.

avatar nicksavov
nicksavov - comment - 5 May 2013

Thanks for posting this, Joe! Can you send a pull request? If you need to learn how, check out this tutorial:
http://docs.joomla.org/Git_for_Coders

I also created a tracker item for this issue:
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=30858

You can receive notifications from it by signing in, going to the item, and clicking "Monitor Item" in the left column.

While we’re transitioning to a new integrated tracker, the JoomlaCode tracker is where we do most of Joomla's bug fixing. You can find out more about the process at:
http://docs.joomla.org/Filing_bugs_and_issues

I'm going to close this item, since we have the above JoomlaCode Tracker Item. If and when you submit a pull request, please reference the JoomlaCode Tracker Item URL:
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=30858

Let me know if you have any questions and I'll be glad to answer. Thanks again, Joe!

avatar nicksavov nicksavov - close - 5 May 2013
avatar zero-24 zero-24 - close - 5 May 2013
avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?
Removed: ?
Build staging

Add a Comment

Login with GitHub to post a comment