node_help potentially adds a message to every page - should this be in hook_help?

Created on 21 April 2015, over 9 years ago
Updated 25 July 2023, over 1 year ago
  // Remind site administrators about the {node_access} table being flagged
  // for rebuild. We don't need to issue the message on the confirm form, or
  // while the rebuild is being processed.
  if ($route_name != 'node.configure_rebuild_confirm' && $route_name != 'system.batch_page.normal' && $route_name != 'help.page.node' && $route_name != 'help.main'
    && \Drupal::currentUser()->hasPermission('access administration pages') && node_access_needs_rebuild()) {
    if ($route_name == 'system.status') {
      $message = t('The content access permissions need to be rebuilt.');
    }
    else {
      $message = t('The content access permissions need to be rebuilt. <a href="@node_access_rebuild">Rebuild permissions</a>.', array('@node_access_rebuild' => \Drupal::url('node.configure_rebuild_confirm')));
    }
    drupal_set_message($message, 'error');
  }

This is super weird code to have in hook_help(). To be fair node_access_needs_rebuild() only hits state but the perms check is not free.

πŸ“Œ Task
Status

Active

Version

9.5

Component
Node systemΒ  β†’

Last updated 4 days ago

No maintainer
Created by

πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

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.

  • πŸ‡¨πŸ‡­Switzerland salvis

    Maybe we really should just put that information into admin/reports/status and be kinda done then?

    No, but it would make sense to check node_access_needs_rebuild() first.

    Actually, I was worried about not seeing the message because the Help module is not in the minimal setup.

Production build 0.71.5 2024