Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache issue for POST request #268

Closed
joeguo opened this issue Jul 10, 2012 · 2 comments
Closed

Cache issue for POST request #268

joeguo opened this issue Jul 10, 2012 · 2 comments

Comments

@joeguo
Copy link

joeguo commented Jul 10, 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.

@infograf768
Copy link
Member

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

@nicksavov
Copy link
Contributor

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!

wilsonge pushed a commit that referenced this issue Jan 23, 2017
dneukirchen pushed a commit to dneukirchen/joomla-cms that referenced this issue Sep 28, 2017
* client fixup

# Conflicts:
#	administrator/components/com_media/resources/scripts/components/app.vue
#	administrator/components/com_media/resources/scripts/store/state.js
#	media/com_media/js/mediamanager.js

added permalink implementation

* client fixup

# Conflicts:
#	administrator/components/com_media/resources/scripts/components/app.vue
#	administrator/components/com_media/resources/scripts/store/state.js
#	media/com_media/js/mediamanager.js

added permalink definition

* client fixup

# Conflicts:
#	administrator/components/com_media/resources/scripts/components/app.vue
#	administrator/components/com_media/resources/scripts/store/state.js
#	media/com_media/js/mediamanager.js

added permalink definition

* client fixup

# Conflicts:
#	administrator/components/com_media/resources/scripts/components/app.vue
#	administrator/components/com_media/resources/scripts/store/state.js
#	media/com_media/js/mediamanager.js

added permalink

* fixed syntax

* added thumbnail support

* media manager generated

* added thumbnail support
client fixed

* added missing modules

* commit

* removed space

* foo deleted

* updated folder

* removed redundant namespace

* added namespace

* fixed return value on getFile

* fixed return value on getFile

* fixed return value on getFile

* updated ignore

* changed a bit :D

* updated local adapter to use params for images folder

* updated local adapter to use params for images folder

* updated getPermalink to return an assoc array

* updated php doc

* updated php doc

* updated php doc

* updated php doc

* updated php doc

* updated php doc

* updated test

* Merge branch 'gsoc17' of https://github.com/joomla-projects/media-manager-improvement into file-serve

# Conflicts:
#	administrator/components/com_media/Model/Api.php

* added a new line after return

* removed line

* removed empty line and renamed method to getUrl

* removed additional namespace

* fixup

* fixup getUrl

* fixup getUrl

* fixup

* fixup

* Merge branch 'gsoc17' of https://github.com/joomla-projects/media-manager-improvement into feature/dropbox-plugin

# Conflicts:
#	administrator/components/com_media/Adapter/AdapterInterface.php
#	administrator/components/com_media/Controller/Api.php
#	administrator/components/com_media/Model/Api.php
#	plugins/filesystem/dropbox/dropbox.php
#	plugins/filesystem/local/Adapter/LocalAdapter.php

fixed missing type

*  added missing variable

* rebuilt

* removed

* updated comment

* added new line
bembelimen pushed a commit to bembelimen/joomla-cms that referenced this issue Jul 15, 2019
Fixing dropdown toolbar buttons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants