Commit a8a89842 authored by catch's avatar catch

Issue #2892179 by Wim Leers, Berdir: Follow-up for #2775381: clearing render...

Issue #2892179 by Wim Leers, Berdir: Follow-up for #2775381: clearing render cache in PerformanceForm::submitForm() is obsolete
parent 32d9c06a
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
use Drupal\Core\Asset\AssetCollectionOptimizerInterface; use Drupal\Core\Asset\AssetCollectionOptimizerInterface;
use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Datetime\DateFormatterInterface; use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -15,13 +14,6 @@ ...@@ -15,13 +14,6 @@
*/ */
class PerformanceForm extends ConfigFormBase { class PerformanceForm extends ConfigFormBase {
/**
* The render cache bin.
*
* @var \Drupal\Core\Cache\CacheBackendInterface
*/
protected $renderCache;
/** /**
* The date formatter service. * The date formatter service.
* *
...@@ -48,7 +40,6 @@ class PerformanceForm extends ConfigFormBase { ...@@ -48,7 +40,6 @@ class PerformanceForm extends ConfigFormBase {
* *
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects. * The factory for configuration objects.
* @param \Drupal\Core\Cache\CacheBackendInterface $render_cache
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
* The date formatter service. * The date formatter service.
* @param \Drupal\Core\Asset\AssetCollectionOptimizerInterface $css_collection_optimizer * @param \Drupal\Core\Asset\AssetCollectionOptimizerInterface $css_collection_optimizer
...@@ -56,10 +47,9 @@ class PerformanceForm extends ConfigFormBase { ...@@ -56,10 +47,9 @@ class PerformanceForm extends ConfigFormBase {
* @param \Drupal\Core\Asset\AssetCollectionOptimizerInterface $js_collection_optimizer * @param \Drupal\Core\Asset\AssetCollectionOptimizerInterface $js_collection_optimizer
* The JavaScript asset collection optimizer service. * The JavaScript asset collection optimizer service.
*/ */
public function __construct(ConfigFactoryInterface $config_factory, CacheBackendInterface $render_cache, DateFormatterInterface $date_formatter, AssetCollectionOptimizerInterface $css_collection_optimizer, AssetCollectionOptimizerInterface $js_collection_optimizer) { public function __construct(ConfigFactoryInterface $config_factory, DateFormatterInterface $date_formatter, AssetCollectionOptimizerInterface $css_collection_optimizer, AssetCollectionOptimizerInterface $js_collection_optimizer) {
parent::__construct($config_factory); parent::__construct($config_factory);
$this->renderCache = $render_cache;
$this->dateFormatter = $date_formatter; $this->dateFormatter = $date_formatter;
$this->cssCollectionOptimizer = $css_collection_optimizer; $this->cssCollectionOptimizer = $css_collection_optimizer;
$this->jsCollectionOptimizer = $js_collection_optimizer; $this->jsCollectionOptimizer = $js_collection_optimizer;
...@@ -71,7 +61,6 @@ public function __construct(ConfigFactoryInterface $config_factory, CacheBackend ...@@ -71,7 +61,6 @@ public function __construct(ConfigFactoryInterface $config_factory, CacheBackend
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
return new static( return new static(
$container->get('config.factory'), $container->get('config.factory'),
$container->get('cache.render'),
$container->get('date.formatter'), $container->get('date.formatter'),
$container->get('asset.css.collection_optimizer'), $container->get('asset.css.collection_optimizer'),
$container->get('asset.js.collection_optimizer') $container->get('asset.js.collection_optimizer')
...@@ -168,10 +157,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { ...@@ -168,10 +157,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
public function submitForm(array &$form, FormStateInterface $form_state) { public function submitForm(array &$form, FormStateInterface $form_state) {
$this->cssCollectionOptimizer->deleteAll(); $this->cssCollectionOptimizer->deleteAll();
$this->jsCollectionOptimizer->deleteAll(); $this->jsCollectionOptimizer->deleteAll();
// This form allows page compression settings to be changed, which can
// invalidate cached pages in the render cache, so it needs to be cleared on
// form submit.
$this->renderCache->deleteAll();
$this->config('system.performance') $this->config('system.performance')
->set('cache.page.max_age', $form_state->getValue('page_cache_maximum_age')) ->set('cache.page.max_age', $form_state->getValue('page_cache_maximum_age'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment