diff --git a/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php b/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php index 9c085bb2654..584ac00cf4b 100644 --- a/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php +++ b/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php @@ -197,7 +197,6 @@ class Block extends DisplayPluginBase { break; case 'block_caching': $this->setOption('block_caching', $form_state['values']['block_caching']); - $this->saveBlockCache($form_state['view']->storage->get('name') . '-'. $form_state['display_id'], $form_state['values']['block_caching']); break; } } @@ -216,7 +215,7 @@ class Block extends DisplayPluginBase { * Update the block delta when you change the machine readable name of the display. */ protected function updateBlockBid($name, $old_delta, $delta) { - $old_hashes = $hashes = variable_get('views_block_hashes', array()); + $old_hashes = $hashes = state()->get('views_block_hashes'); $old_delta = $name . '-' . $old_delta; $delta = $name . '-' . $delta; @@ -240,27 +239,7 @@ class Block extends DisplayPluginBase { // Update the hashes if needed. if ($hashes != $old_hashes) { - variable_set('views_block_hashes', $hashes); - } - } - - /** - * Save the block cache setting in the blocks table if this block allready - * exists in the blocks table. Dirty fix untill http://drupal.org/node/235673 gets in. - */ - protected function saveBlockCache($delta, $cache_setting) { - if (strlen($delta) >= 32) { - $delta = md5($delta); - } - if (db_table_exists('block') && $bid = db_query("SELECT bid FROM {block} WHERE module = 'views' AND delta = :delta", array( - ':delta' => $delta))->fetchField()) { - db_update('block') - ->fields(array( - 'cache' => $cache_setting, - )) - ->condition('module', 'views') - ->condition('delta', $delta) - ->execute(); + state()->set('views_block_hashes', $hashes); } } diff --git a/core/modules/views/views.module b/core/modules/views/views.module index c29136a4fff..6608d474582 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -669,9 +669,9 @@ function views_block_info() { } // Only save hashes if they have changed. - $old_hashes = variable_get('views_block_hashes', array()); + $old_hashes = state()->get('views_block_hashes'); if ($hashes != $old_hashes) { - variable_set('views_block_hashes', $hashes); + state()->set('views_block_hashes', $hashes); } views_cache_set('views_block_items', $items, TRUE); @@ -686,7 +686,7 @@ function views_block_view($delta) { $start = microtime(TRUE); // if this is 32, this should be an md5 hash. if (strlen($delta) == 32) { - $hashes = variable_get('views_block_hashes', array()); + $hashes = state()->get('views_block_hashes'); if (!empty($hashes[$delta])) { $delta = $hashes[$delta]; }