Deprecating hook_query_alter

Created on 13 April 2020, over 4 years ago
Updated 30 January 2023, almost 2 years ago

Problem/Motivation

The hook_query_alter() is all called for every tagged query. It is only called on tagged queries due to performance concerns - see #619580: Only invoke query_alter on tagged queries . However, if the only queries it is called on are tagged queries and tagged queries have their own alter hook what's the point of the generic alter hook that does not fire on untagged queries? Let's do less and only trigger hook_query_TAG_alter.

For an overview of contrib modules that implement the hook_query_alter: http://grep.xnddx.ru/search?text=hook_query_alter&filename=

Proposed resolution

Deprecate hook_query_alter() because not all queries are alterable and all that are are tagged and have a specific hook_query_TAG_alter fired.

Remaining tasks

User interface changes

None

API changes

hook_query_alter() deprecated

Data model changes

None

Release notes snippet

@todo

📌 Task
Status

Needs work

Version

10.1

Component
Database 

Last updated 2 days ago

  • Maintained by
  • 🇳🇱Netherlands @daffie
Created by

🇳🇱Netherlands daffie

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.

  • The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

Production build 0.71.5 2024