" The theme registry has been rebuilt. Turn off this feature on production websites. "

I think this warning is too obtrusive for something which is displayed constantly. The warning area shows all warnings from Drupal, not just this one. It's risky to display it constantly like this - the user just starts to ignore everything in it.

I also find it's more difficult to tweak the site layout with these warnings always near the top of the page. It breaks the WYSIWYG aspect of site design.

I suggest adding a new option on the theme config page that allows the user to switch the registry rebuild warning off.

Obviously these warnings are important. So here's a two ideas how they could be made less obtrusive, but still effective:

1) Allow the user to switch off the warning, but only for a limited time (like two hours), or...

2) If warnings are switched off, then force the display of the warning only when the number of users connected rises above a low threshold, like 5. So if the site goes live, the warning should appear.

Comments

As a workaround, you can turn off the registry rebuild warnings by editing one file. If you do, MAKE A NOTE TO REMIND YOURSELF TO TURN OFF REGISTRY REBUILDING LATER

You need to make a small change to template.theme-registry.inc -

In a standard Zen installation you can find this in /sites/all/themes/zen/zen

I thought that the correct way to edit a theme file is to copy the file into the subtheme's folder and edit it there. But when I tried this, it didn't seem to have any effect. So, I edited the original file in /zen/zen. If you do this, then to be safe, make a backup copy of it before you edit.

On line 63 (in the current version 6.x-1.0-beta3), just add // to the beginning of the line, so it looks like this

//  drupal_set_message(t('The theme registry has been rebuilt.  etc...

this turns it into a comment, so it will have no effect.

I don't know how this change will affect future updates to the theme, because I don't know how updating works. To be safe, restore the backup before you update Zen.

An alternative approach might be to edit the style (under div.warning {}) in messages.css (it's in the same folder, or your subtheme folder). I haven't tried this myself. Maybe you can remove the background color, for example. But this will affect all Drupal warnings, not just the rebuild warning.

Status:Active» Needs review
StatusFileSize
new1.22 KB

Here's a patch that will use Drupal's flood mechanism to limit the warnings to 1 per hour.

Status:Needs review» Reviewed & tested by the community

Nice one!

I may tweak this a little bit before committing it, but this is really handy! Thanks, Dylan!

Displaying the warning "The theme registry has been rebuilt." only once an hour seems confusing to me. Doesn't this imply that the theme registry is not rebuilt on other requests?

If the above patch is implemented, I'd suggest changing the wording of the warning message to something like "The theme registry is being rebuilt on every request. Remember to turn off this feature on production websites."

What about bsimon's suggestion of giving the user control over whether or not the warning message is shown? I prefer having the option to show or hide the warning message through the settings page.

mr.baileys: I agree with you about clarifying the message.

Providing an option to disable the warning completely is a tad more work. I also think that if the message is disabled, there still needs to be a backup warning system -- such on the "Status Report" page (admin/reports/status). I think this is accomplished with hook_requirements()

To me, though, once per hour seems like an easy enough compromise.

I would also like the option to remove this line. Simple checkbox in the config and if it's still set, let me know in the "Status Report".

Thanks,
Jordan

Status:Reviewed & tested by the community» Needs review

Moving the decision for this to the user and create a UI for it is kind of a cop-out, we should try and make a choice ourselves. I like the proposed wording in #4.

I like the solution of combining the flood protection with the warning-message on the admin/reports/status- screen as proposed by grendzy. However, I think hook_requirements can only be used by modules (not themes), and wasn't able to successfully add a message to it using the snippet below...

function zen_requirements($phase) {
  $zen_requirements = array();
  if ($phase == 'runtime') {
    if (theme_get_setting('zen_rebuild_registry') && $theme == $GLOBALS['theme']) {
      $zen_requirements['zen'] = array(
        'title' => 'Zen Registry Rebuild',
        'severity' => REQUIREMENT_WARNING,
        'description' => t("The theme registry is being rebuilt on every request. Remember to <a href='!link'>Turn off</a> this feature on production websites.", array('!link' => base_path() . 'admin/build/themes/settings/' . $GLOBALS['theme'])),
      );
    }
  }
  return $zen_requirements;
}

StatusFileSize
new1.08 KB

The approach taken int he attached patch ensures the message is not displayed more than once per page. It is also much simpler than the attached patches. I haven't applied the other patches here, but they seem both more comprehensive and complicated than this one.

StatusFileSize
new1.01 KB

@Bevan: the flood protection in #2 also takes care of limiting the message to at most once per page (it additionally limits it to once per hour/visitor). The idea of this thread is to stop displaying this message on every single request, since a) the user will stop noticing it after a while, and b) it makes it harder to work on your theme in development without the warning.

Attached is a patch against -dev that combines flood protection with the new wording.

Tested patch in #10. Aplies and works well so far. I'll have to wait an hour to check the message re-appears though! ;)

Status:Needs review» Needs work

I've been using this extensively for several days now and it works like a charm. Reviewing the code in the patch, everything looks fine except that I would have expected

<?php
base_path
() . 'admin/build/themes/settings/' . $GLOBALS['theme']
?>
should be
<?php
url
('admin/build/themes/settings/' . $GLOBALS['theme'])
?>
Otherwise this is RTBC IMO.

Title:Make registry rebuild warning less obtrusive or allow user to switch it offMake registry rebuild warning less obtrusive

Thanks for taking the time to test this Bevan,

I agree that base_path isn't the correct way to render internal links, but I left it in since this is addressed in another bug/patch (#325630: Broken link in "Theme Registry Rebuilt"-warning when Clean URL's are disabled)…

Do you think I should merge both?

Status:Needs work» Reviewed & tested by the community

If this were core, yes, but I don't think it matters much in contrib. In any case this is RTBC.

Status:Reviewed & tested by the community» Fixed

Very good ideas in this thread. Thanks!

Also, since only those user with 'administer site configuration' privileges can access the theme settings, we shouldn't be displaying the warning to other users.

I fear that simply displaying the warning once per hour might be too easy to miss. So how about this compromise? 3 times in a row and then nothing for an hour on most pages, but always display the warning on admin pages. Re-open if you disagree.

I just want to chime in that we should be informing the user that they won't see the message for another hour or something to that effect.

Because? It helps if you can give a reason why.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.