core/modules/filter/filter.module | 18 ------------ .../filter/lib/Drupal/filter/Annotation/Filter.php | 10 ------- .../lib/Drupal/filter/Entity/FilterFormat.php | 9 ------ .../filter/lib/Drupal/filter/Plugin/FilterBase.php | 8 ------ .../lib/Drupal/filter/Tests/FilterCrudTest.php | 17 ++---------- .../Plugin/Filter/FilterTestUncacheable.php | 32 ---------------------- 6 files changed, 2 insertions(+), 92 deletions(-) diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index eb0611b..3ef4476 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -297,24 +297,6 @@ function filter_fallback_format() { } /** - * Checks if the text in a certain text format is allowed to be cached. - * - * This function can be used to check whether the result of the filtering - * process can be cached. A text format may allow caching depending on the - * filters enabled. - * - * @param string $format_id - * The text format ID to check. - * - * @return bool - * TRUE if the given text format allows caching, FALSE otherwise. - */ -function filter_format_allowcache($format_id) { - $format = $format_id ? entity_load('filter_format', $format_id) : FALSE; - return !empty($format->cache); -} - -/** * Runs all the enabled filters on a piece of text. * * Note: Because filters can inject JavaScript or execute PHP code, security is diff --git a/core/modules/filter/lib/Drupal/filter/Annotation/Filter.php b/core/modules/filter/lib/Drupal/filter/Annotation/Filter.php index a14b72f..808357c 100644 --- a/core/modules/filter/lib/Drupal/filter/Annotation/Filter.php +++ b/core/modules/filter/lib/Drupal/filter/Annotation/Filter.php @@ -65,16 +65,6 @@ class Filter extends Plugin { public $status = FALSE; /** - * Specifies whether the filtered text can be cached. - * - * Note that setting this to FALSE makes the entire text format not cacheable, - * which may have an impact on the site's overall performance. - * - * @var bool (optional) - */ - public $cache = TRUE; - - /** * The default settings for the filter. * * @var array (optional) diff --git a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php index ff6954f..961ff6c 100644 --- a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php +++ b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php @@ -213,15 +213,6 @@ public function preSave(EntityStorageInterface $storage) { // @todo Do not save disabled filters whose properties are identical to // all default properties. - - // Determine whether the format can be cached. - // @todo This is a derived/computed definition, not configuration. - $this->cache = TRUE; - foreach ($this->filters()->getAll() as $filter) { - if ($filter->status && !$filter->cache) { - $this->cache = FALSE; - } - } } /** diff --git a/core/modules/filter/lib/Drupal/filter/Plugin/FilterBase.php b/core/modules/filter/lib/Drupal/filter/Plugin/FilterBase.php index c053de2..44421e1 100644 --- a/core/modules/filter/lib/Drupal/filter/Plugin/FilterBase.php +++ b/core/modules/filter/lib/Drupal/filter/Plugin/FilterBase.php @@ -45,13 +45,6 @@ public $weight = 0; /** - * A Boolean indicating whether the text processed by this filter may be cached. - * - * @var bool - */ - public $cache = TRUE; - - /** * An associative array containing the configured settings of this filter. * * @var array @@ -72,7 +65,6 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition parent::__construct($configuration, $plugin_id, $plugin_definition); $this->provider = $this->pluginDefinition['provider']; - $this->cache = $this->pluginDefinition['cache']; $this->setConfiguration($configuration); } diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterCrudTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterCrudTest.php index 041f309..b592c5f 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterCrudTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterCrudTest.php @@ -65,8 +65,8 @@ function testTextFormatCrud() { $format->save(); $this->verifyTextFormat($format); - // Add a uncacheable filter and save again. - $format->setFilterConfig('filter_test_uncacheable', array( + // Add a filter_test_replace filter and save again. + $format->setFilterConfig('filter_test_replace', array( 'status' => 1, )); $format->save(); @@ -90,22 +90,9 @@ function verifyTextFormat($format) { $filter_format = entity_load('filter_format', $format->format); $this->assertEqual($filter_format->format, $format->format, format_string('filter_format_load: Proper format id for text format %format.', $t_args)); $this->assertEqual($filter_format->name, $format->name, format_string('filter_format_load: Proper title for text format %format.', $t_args)); - $this->assertEqual($filter_format->cache, $format->cache, format_string('filter_format_load: Proper cache indicator for text format %format.', $t_args)); $this->assertEqual($filter_format->weight, $format->weight, format_string('filter_format_load: Proper weight for text format %format.', $t_args)); // Check that the filter was created in site default language. $this->assertEqual($format->langcode, $default_langcode, format_string('filter_format_load: Proper language code for text format %format.', $t_args)); - - // Verify the 'cache' text format property according to enabled filters. - $cacheable = TRUE; - foreach ($format->filters() as $name => $filter) { - // If this filter is not cacheable, update $cacheable accordingly, so we - // can verify $format->cache after iterating over all filters. - if ($filter->status && !$filter->cache) { - $cacheable = FALSE; - break; - } - } - $this->assertEqual($filter_format->cache, $cacheable, 'Text format contains proper cache property.'); } } diff --git a/core/modules/filter/tests/filter_test/lib/Drupal/filter_test/Plugin/Filter/FilterTestUncacheable.php b/core/modules/filter/tests/filter_test/lib/Drupal/filter_test/Plugin/Filter/FilterTestUncacheable.php deleted file mode 100644 index a1286a9..0000000 --- a/core/modules/filter/tests/filter_test/lib/Drupal/filter_test/Plugin/Filter/FilterTestUncacheable.php +++ /dev/null @@ -1,32 +0,0 @@ -