Provide a mechanism for a UI-only user to clear the cache if Drupal is unavailable

Created on 3 September 2025, 4 days ago

Problem/Motivation

Sometimes after running an update, the cache becomes corrupted and has to be cleared. Because Drupal itself is unavailable, this has to be done via the command line.

In order for the UI-only approach to be viable for users, there needs to be away for them to clear the cache in this scenario.

This issue is just to capture this as a scenario to address and possibly discuss some ideas for how to address this.

✨ Feature request
Status

Active

Component

Infrastructure

Created by

πŸ‡¦πŸ‡ΊAustralia pameeela

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

Comments & Activities

  • Issue created by @pameeela
  • πŸ‡¦πŸ‡ΊAustralia pameeela
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    I think that, in Drupal CMS, we could add a drush cr as a post-update-cmd Composer script.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    In addition to #3, we can also put the cache clear block (provided by core) into the dashboard, so users don't have to go digging around for it.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    @catch directed me to πŸ“Œ Use a better container cache key Active , which would also greatly mitigate this problem.

  • πŸ‡ΊπŸ‡ΈUnited States mglaman WI, USA

    chatted w/ phenaproxima and I understand the problem, now.

    Sometimes after running an update, the cache becomes corrupted and has to be cleared.

    This confused me. It's not _update_ as in Drupal database updates but dependency updates. A module is update which has modified it's service constructors. Drupal is still using a previous container cache for the previous version of the module. When the user goes to their Drupal site, the container constructs the services using previous arguments and we WSOD.

    πŸ“Œ Use a better container cache key Active solves this by using dependency version information to vary the container cache. So I think Drupal CMS can provide a Composer script which _kind of_ does the same thing. Without calling `drupal_rebuild`. When calling `drupal_rebuild` all caches get destroyed, which can be bad ahead of actually running updates.

    Instead it should have a script which does clears the container cache only. This can be done via drush cc container or a PHP script like:

    $autoloader = require_once __DIR__ . '/autoload.php';
    $request = Request::createFromGlobals();
    $kernel = new DrupalKernel('prod', $class_loader);
    $kernel->setSitePath(DrupalKernel::findSitePath($request));
    $kernel->invalidateContainer();
    
  • πŸ‡¦πŸ‡ΊAustralia pameeela

    @mglaman updated the IS to clarify that yes it's composer updates rather than db updates!

Production build 0.71.5 2024