Clear Caches button should not be part of Performance form

Created on 13 January 2022, over 2 years ago
Updated 18 May 2023, about 1 year ago

Problem/Motivation

Some modules, such as config_readonly, alter any form inheriting from ConfigFormBase to prevent it from modifying active configuration. This is useful in sites whose configuration is controlled exclusively through deployment processes involving configuration imported from YAML. However, since the “Clear Caches” button is part of PerformanceForm, which is a config form, caches cannot be cleared in environments which enable such a module. The “Clear Caches” button should therefore live in its own dedicated non-config form.

Some might argue that this is a contrib-space problem; my counter-argument is that a form submission that does not touch configuration does not belong in a form inheriting from ConfigFormBase.

Steps to reproduce

  • Install/enable the config_readonly module.
  • Add this code to settings.php: $settings['config_readonly'] = TRUE;
  • Navigate to /admin/config/development/performance and click the “Clear Caches” button
  • Observe that a warning message is displayed, and caches are not cleared.

Proposed resolution

Split the system_performance_settings form into two forms. Add a controller to display the “Clear Caches” form above the “Performance” form.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

TBD?

📌 Task
Status

Fixed

Version

10.1

Component
System 

Last updated 1 day ago

No maintainer
Created by

🇺🇸United States daniel_j

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States tedfordgif

    I'll work on the CR.

  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • Status changed to RTBC about 1 year ago
  • 🇺🇸United States smustgrave

    Will mark this but think we could change this to a feature request and add test coverage.

  • Status changed to Needs review about 1 year ago
  • 🇬🇧United Kingdom catch

    I'm not sure whether this needs test coverage or not, but let's check the following:

    1. Is there any existing test coverage of the page?

    2. Manual testing to confirm there's no visual regression.

  • Status changed to RTBC about 1 year ago
  • 🇺🇸United States smustgrave

    #15.1 = There are still references to admin/config/development/performance in BlockInvalidRegionTest and ConfigTranslationCacheTest where the "Clear cache" button is pressed.

    #15.2 Attaching screenshots but no visual regression.

    Before

    After

  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    29,260 pass, 20 fail
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    29,260 pass, 20 fail
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    29,260 pass, 20 fail
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    29,260 pass, 20 fail
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    29,260 pass, 20 fail
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    29,260 pass, 20 fail
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    29,260 pass, 20 fail
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    29,260 pass, 20 fail
  • Status changed to Needs work about 1 year ago
  • 🇳🇿New Zealand quietone New Zealand

    It is pleasant to find an issue with an up to date issue summary and a short one too! I read the IS and the comments and I find that all the questions have been answered.

    I tested the patch, using the steps in the issue summary. I can confirm that the patch fixes the problem. However, this is re-testing the patch on 9.3.x instead of 10.1.x.

    I also found other tests that use the 'Clear all caches' button.

    $ git grep 'submitForm.*Clear all caches' | awk -F: '{print $1}' | sort -u | nl
         1  core/modules/block/tests/src/Functional/BlockInvalidRegionTest.php
         2  core/modules/config_translation/tests/src/Functional/ConfigTranslationCacheTest.php
         3  core/modules/menu_ui/tests/src/Functional/MenuLinkReorderTest.php
    

    Next, I read the CR. I think it needs some improvement and here is what I found:

    • "This could impact any custom or contrib modules using hook_form_alter to modify the Clear Caches button behavior, although there are no known examples at present.". And yet the steps to reproduce show the problem with a contrib module. So, that statement seems to be incorrect. Or, am I missing something?
    • "The Clear Caches button". It will be clearer if this uses the actual text of the button, 'Clear all caches'.
    • The first sentence should be split into two to make it easier to understand.
    • The version field should be completed.

    I am tagging for CR update.

    I read the patch. Everything looks in order and the comments are easy to understand.

    So, this just needs the updates to the CR and then it should be good to go.

  • Status changed to Needs review about 1 year ago
  • 🇺🇸United States daniel_j

    @quietone I have updated the CR to address your concerns.

  • Status changed to RTBC about 1 year ago
  • 🇺🇸United States smustgrave

    CR changes look good. Hopefully makes it for 10.1

  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    29,260 pass, 20 fail
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    29,260 pass, 20 fail
    • catch committed 73c3cea7 on 10.1.x
      Issue #3258433 by daniel_j, smustgrave, tedfordgif, quietone: Clear...
  • Status changed to Fixed about 1 year ago
  • 🇬🇧United Kingdom catch

    Committed 73c3cea and pushed to 10.1.x. Thanks!

  • 🇬🇧United Kingdom longwave UK

    Published the change record.

  • Status changed to Fixed about 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024