|
From: <gem...@li...> - 2011-09-19 10:35:22
|
Revision: 35
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=35&view=rev
Author: matijsdejong
Date: 2011-09-19 10:35:16 +0000 (Mon, 19 Sep 2011)
Log Message:
-----------
- created readonly option for request cache to prevent bug #8
Modified Paths:
--------------
trunk/library/classes/Gems/Controller/BrowseEditAction.php
trunk/library/classes/Gems/Default/TokenPlanAction.php
trunk/library/classes/Gems/Util/RequestCache.php
Modified: trunk/library/classes/Gems/Controller/BrowseEditAction.php
===================================================================
--- trunk/library/classes/Gems/Controller/BrowseEditAction.php 2011-09-19 08:19:00 UTC (rev 34)
+++ trunk/library/classes/Gems/Controller/BrowseEditAction.php 2011-09-19 10:35:16 UTC (rev 35)
@@ -585,13 +585,14 @@
* @param string $sourceAction The action to get the cache from if not the current one.
* @return array
*/
- public function getCachedRequestData($includeDefaults = true, $sourceAction = null)
+ public function getCachedRequestData($includeDefaults = true, $sourceAction = null, $readonly = false)
{
if (! $this->requestCache) {
$this->requestCache = $this->util->getRequestCache();
if ($sourceAction) {
$this->requestCache->setSourceAction($sourceAction);
}
+ $this->requestCache->setReadonly($readonly);
$this->requestCache->setMenu($this->menu);
$this->requestCache->setRequest($this->request);
Modified: trunk/library/classes/Gems/Default/TokenPlanAction.php
===================================================================
--- trunk/library/classes/Gems/Default/TokenPlanAction.php 2011-09-19 08:19:00 UTC (rev 34)
+++ trunk/library/classes/Gems/Default/TokenPlanAction.php 2011-09-19 10:35:16 UTC (rev 35)
@@ -128,7 +128,7 @@
$model = $this->getModel();
// Set the request cache to use the search params from the index action
- $this->getCachedRequestData(true, 'index');
+ $this->getCachedRequestData(true, 'index', true);
// Load the filters
$this->_applySearchParameters($model);
Modified: trunk/library/classes/Gems/Util/RequestCache.php
===================================================================
--- trunk/library/classes/Gems/Util/RequestCache.php 2011-09-19 08:19:00 UTC (rev 34)
+++ trunk/library/classes/Gems/Util/RequestCache.php 2011-09-19 10:35:16 UTC (rev 35)
@@ -64,6 +64,13 @@
protected $_programParams = array();
/**
+ * True if the cache should not be written to.
+ *
+ * @var boolean
+ */
+ protected $_readonly = false;
+
+ /**
* The module / controller /action of the request in an array.
*
* @var array
@@ -269,6 +276,12 @@
return $this;
}
+ /**
+ * Ste the keys stored fot this cache
+ *
+ * @param array $programParams
+ * @return Gems_Util_RequestCache (continuation pattern)
+ */
public function setProgramParams(array $programParams)
{
foreach ($programParams as $key => $value) {
@@ -279,13 +292,29 @@
// Store result
$this->_programParams = $programParams;
- $this->session->requestCache[$this->getStorageKey()] = $programParams;
+ if (! $this->_readonly) {
+ $this->session->requestCache[$this->getStorageKey()] = $programParams;
+ }
+
return $this;
}
/**
+ * Makes sure any new values in the request are not written to the cache.
*
+ * @param boolen $value
+ * @return Gems_Util_RequestCache (continuation pattern)
+ */
+ public function setReadonly($value = true)
+ {
+ $this->_readonly = (boolean) $value;
+
+ return $this;
+ }
+
+ /**
+ *
* @param Zend_Controller_Request_Abstract $request
* @return Gems_Util_RequestCache (continuation pattern)
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|