Issue #1604978 by dawehner | tim.plunkett: Fixed views_plugin_cache tests by correcting some get_results_key to get_output_key.

8.0.x
dereine 2012-06-10 13:50:52 +02:00 committed by Tim Plunkett
parent 42858f6bb3
commit 6a9ba69baa
2 changed files with 29 additions and 3 deletions

View File

@ -27,6 +27,24 @@ class views_plugin_cache extends views_plugin {
*/
var $table = 'cache_views_data';
/**
* Stores the cache id used for the results cache, once get_results_key() got
* executed.
*
* @see views_plugin_cache::get_results_key
* @var string
*/
public $_results_key;
/**
* Stores the cache id used for the output cache, once get_output_key() got
* executed.
*
* @see views_plugin_cache::get_output_key
* @var string
*/
public $_output_key;
/**
* Initialize the plugin.
*
@ -99,7 +117,7 @@ class views_plugin_cache extends views_plugin {
case 'output':
$this->gather_headers();
$this->storage['output'] = $this->view->display_handler->output;
cache($this->table)->set($this->get_results_key(), $this->storage, $this->cache_set_expire($type));
cache($this->table)->set($this->get_output_key(), $this->storage, $this->cache_set_expire($type));
break;
}
}
@ -130,7 +148,7 @@ class views_plugin_cache extends views_plugin {
}
return FALSE;
case 'output':
if ($cache = cache($this->table)->get($this->get_results_key())) {
if ($cache = cache($this->table)->get($this->get_output_key())) {
if (!$cutoff || $cache->created > $cutoff) {
$this->storage = $cache->data;
$this->view->display_handler->output = $cache->data['output'];
@ -253,7 +271,7 @@ class views_plugin_cache extends views_plugin {
foreach (array('query','count_query') as $index) {
// If the default query back-end is used generate SQL query strings from
// the query objects.
if ($build_info[$index] instanceof SelectQueryInterface) {
if ($build_info[$index] instanceof Drupal\Core\Database\Query\Select) {
$query = clone $build_info[$index];
$query->preExecute();
$build_info[$index] = (string)$query;

View File

@ -37,6 +37,14 @@ class views_plugin_display extends views_plugin {
*/
var $extender = array();
/**
* Stores the rendered output of the display.
*
* @see view::render
* @var string
*/
public $output = NULL;
function init(&$view, &$display, $options = NULL) {
$this->view = &$view;
$this->display = &$display;