Deprecating hook_query_alter

Created on 13 April 2020, about 4 years ago
Updated 30 January 2023, over 1 year 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 less than a minute 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.69.0 2024