Problem/Motivation

As per the docs running Rebuild.php script can clear Drupal cache even when Drupal itself does not work. On running it from browser It does clears the cache but as written in the code \Drupal::messenger()->addStatus('Cache rebuild complete.'); of the script it doesn't shows the status message "Cache rebuild complete."

Steps to reproduce

  1. Add $settings['rebuild_access'] = TRUE; in your settings.php file.
  2. Browse the url /core/rebuild.php
  3. It redirects to home page after clearing the cache but doesn’t shows any status message.

Proposed resolution

Either remove the message or handle the redirection with different ways.

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

None

Comments

saxenaakansha30 created an issue. See original summary.

saxenaakansha30’s picture

Issue summary: View changes
saxenaakansha30’s picture

Issue summary: View changes
mohit.bansal623’s picture

@saxenaakansha30 Redirect response is also not working, so removing the success message will solve the issue ? Please confirm.

spokje’s picture

Title: Status Message now showing on running Rebuild.php » Status Message not showing on running Rebuild.php

Fixing typo in title

saxenaakansha30’s picture

@mohit.bansal623: If removing the status message is the only option then it will solve the issue. But is there any other way you could think of with which we can still show status message.

mstrelan’s picture

Title: Status Message not showing on running Rebuild.php » Status message does not appear after running /core/rebuild.php
Version: 9.0.x-dev » 10.1.x-dev
Issue tags: -status messages +Bug Smash Initiative

Tested this on 10.1.x and can confirm the issue still exists. One possible solution would be to define a route and controller that simply sets the message and performs the redirect, then rebuild.php can redirect to that route. That seems like overkill though, and I'm sure there is a simpler way.

mstrelan’s picture

I came across #2940148: Messenger service can't set messages super early and loses reference to flashbag reference on rebuild which sounded related. Re-rolled the patch for that issue and tested this again and it was fixed. Marking as a duplicate of that issue.