Skip to content

Commit

Permalink
Fixed a bug with static cache clearing the entire directory instead o…
Browse files Browse the repository at this point in the history
…f targetted files when using cache-breaking rules. Corrected a bug in `{exp:stash:cache}` that prevented a custom context being used for cached items
  • Loading branch information
croxton committed Jan 5, 2015
1 parent 143b94c commit 4a1dff3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

* Author: [Mark Croxton](http://hallmark-design.co.uk/)

### Version 2.6.0
### Version 2.6.1

This is the development version of Stash. Test thoroughly before using in production.

Expand Down
2 changes: 1 addition & 1 deletion system/expressionengine/third_party/stash/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
if (! defined('STASH_VER'))
{
define('STASH_NAME', 'Stash');
define('STASH_VER', '2.6.0');
define('STASH_VER', '2.6.1');
define('STASH_AUTHOR', 'Mark Croxton');
define('STASH_DOCS', 'http://github.com/croxton/Stash/');
define('STASH_DESC', 'Stash: save text and code snippets for reuse throughout your templates.');
Expand Down
6 changes: 3 additions & 3 deletions system/expressionengine/third_party/stash/mod.stash.php
Original file line number Diff line number Diff line change
Expand Up @@ -2554,6 +2554,9 @@ public function cache()
$this->EE->TMPL->tagparams['name'] = $this->_parse_context($context) . ':' . $this->EE->TMPL->tagparams['name'];
}

// context parameter MUST be set to the page URI pointer
$this->EE->TMPL->tagparams['context'] = '@URI';

// set a default parse depth of 4
$this->EE->TMPL->tagparams['parse_depth'] = $this->EE->TMPL->fetch_param('parse_depth', 4);

Expand All @@ -2562,9 +2565,6 @@ public function cache()

// set a default refresh of 0 (never)
$this->EE->TMPL->tagparams['refresh'] = $this->EE->TMPL->fetch_param('refresh', 0);

// set the context to the page URI pointer by default
$this->EE->TMPL->tagparams['context'] = $this->EE->TMPL->fetch_param('context', '@URI');

// mandatory parameter values for cached items
$this->EE->TMPL->tagparams['scope'] = 'site';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,10 @@ function delete_matching_keys($bundle_id = FALSE, $session_id=NULL, $site_id = 1
$deleted = FALSE; // have keys been deleted from the database?
$clear_static = TRUE; // attempt to delete corresponding *individual* static cache files?
// Clear the static cache?
// Delete entire static cache for this site if bundle is 'static' or not specified
// and scope is 'site', 'all' or not specified, and we're not invalidating
if ($this->EE->config->item('stash_static_cache_enabled') && $invalidate == 0)
// Can we clear the entire static cache in one go (to minimize disk access)?
if ($this->EE->config->item('stash_static_cache_enabled')
&& $regex == NULL
&& $invalidate == 0)
{
if ( ! $bundle_id || $this->_can_static_cache($bundle_id) )
{
Expand Down

0 comments on commit 4a1dff3

Please sign in to comment.