improved flag performances issues without a patch but with hook_module_implements_alter in materio_flag

This commit is contained in:
2026-07-17 14:16:40 +02:00
parent 1640f3629b
commit 79b7047ed9
2 changed files with 49 additions and 12 deletions

View File

@@ -251,7 +251,8 @@
"Integrate Address with Search API https://www.drupal.org/project/address/issues/2812659": "https://www.drupal.org/files/issues/2020-11-02/integrate-address-searchapi-2812659-56.patch"
},
"drupal/mailjet": {
"DrupalmailjetControllerMailjetRegisterController::redirectRegister() does not exist https://www.drupal.org/project/mailjet/issues/3450474": "https://www.drupal.org/files/issues/2024-05-29/mailjet-15615025-5.patch"
"DrupalmailjetControllerMailjetRegisterController::redirectRegister() does not exist https://www.drupal.org/project/mailjet/issues/3450474": "https://www.drupal.org/files/issues/2024-05-29/mailjet-15615025-5.patch",
"MailjetConfigurationAccessCheck blocks access to all pages for users except admin https://www.drupal.org/project/mailjet/issues/3539776": "https://www.drupal.org/files/issues/2025-08-05/0001-fix-mailjetconfigurationaccesscheck-blocking-access.patch"
},
"drupal/pwa": {
"Manifest doesn't have a maskable icon https://www.drupal.org/project/pwa/issues/3165433": "https://www.drupal.org/files/issues/2024-03-10/manifest-doesnt-have-a-maskable-icon-error-3165433-20.patch",
@@ -276,12 +277,6 @@
},
"drupal/term_reference_tree": {
"Term Reference Tree: Re-implement Track List https://www.drupal.org/project/term_reference_tree/issues/3064280": "https://www.drupal.org/files/issues/2024-08-26/term_reference_tree-3064280_bring_back_tracklist-22.patch"
},
"drupal/flag": {
"remove flag hooks to allow site to be accessible again https://www.drupal.org/project/flag/issues/3200806": "./patches/flag-commenthooks.patch"
},
"drupal/mailjet": {
"MailjetConfigurationAccessCheck blocks access to all pages for users except admin https://www.drupal.org/project/mailjet/issues/3539776": "https://www.drupal.org/files/issues/2025-08-05/0001-fix-mailjetconfigurationaccesscheck-blocking-access.patch"
}
},
"archived-patches": {
@@ -292,7 +287,6 @@
"With no blocks, clicking on the Custom Blocks tab crashes site https://www.drupal.org/project/structure_sync/issues/3070414":"https://www.drupal.org/files/issues/2022-03-23/PluginNotFoundException-3070414-3.patch"
},
"drupal/commerce_license": {
"ability to re-purchase a license to extend it https://www.drupal.org/project/commerce_license/issues/2943888": "https://www.drupal.org/files/issues/2022-02-21/reroll-commerce_license-allow-renewal-2943888-141.patch",
"ability to re-purchase a license to extend it https://www.drupal.org/project/commerce_license/issues/2943888": "https://www.drupal.org/files/issues/2022-02-21/reroll-commerce_license-allow-renewal-2943888-141.patch"
},
"drupal/commerce_stripe" : {
@@ -302,18 +296,19 @@
"undefined index name 18 https://www.drupal.org/project/field_group/issues/3064890" : "https://www.drupal.org/files/issues/2020-10-01/field_group-undefined-index-name-3064890-18.patch",
"undefined index name 16 https://www.drupal.org/project/field_group/issues/3064890" : "https://www.drupal.org/files/issues/2020-08-10/field_group-undefined-index-name-3064890-16.patch"
},
"drupal/mailjet": {
"https://www.drupal.org/project/mailjet/issues/3325412":"https://www.drupal.org/files/issues/2022-12-05/mailjet-list_instead_of_listid.patch"
},
"drupal/advancedqueue": {
"Issue with configuration schema advancedqueue.backend.[id] https://www.drupal.org/project/advancedqueue/issues/3469869": "https://git.drupalcode.org/project/advancedqueue/-/commit/a8864851cdfa40c9e38a3f5f64885baf1937375e.patch"
},
"drupal/mailjet": {
"Error: Class MailjetTools/MailjetApi not found in Drupal/mailjet/Form/MailjetApiForm->submitForm() https://www.drupal.org/project/mailjet/issues/3464788":"https://www.drupal.org/files/issues/2024-08-20/mailjetApiForm_use_mailjettools_mailjetapi.patch",
"Error: Class MailjetTools/UsStates not found https://www.drupal.org/project/mailjet/issues/3469059":"https://www.drupal.org/files/issues/2024-08-20/mailjet_settingsform_usstates.patch"
"Error: Class MailjetTools/UsStates not found https://www.drupal.org/project/mailjet/issues/3469059":"https://www.drupal.org/files/issues/2024-08-20/mailjet_settingsform_usstates.patch",
"https://www.drupal.org/project/mailjet/issues/3325412":"https://www.drupal.org/files/issues/2022-12-05/mailjet-list_instead_of_listid.patch"
},
"drupal/user_history": {
"init batch : field_storage_values misses type https://www.drupal.org/project/user_history/issues/3311360": "https://www.drupal.org/files/issues/2022-09-23/user_history__field_storage_values__miss__type.patch"
},
"drupal/flag": {
"remove flag hooks to allow site to be accessible again https://www.drupal.org/project/flag/issues/3200806": "./patches/flag-commenthooks.patch"
}
},
"drupal-scaffold": {

View File

@@ -1 +1,43 @@
<?php
/**
* @file
* Contains materio_flag.module.
*/
/**
* Implements hook_module_implements_alter().
*
* flag_lists creates one Flag *config* entity per user list (1700+ on this
* site). Several flag.module hooks call FlagService::getAllFlags() and loop over
* every flag for each entity view and each entity form, running an isFlagged()
* query and an access check per flag. This makes node view and, above all, node
* edit (flag_form_alter) time out.
*
* All these flags are configured with show_in_links / show_as_field /
* show_on_form / show_contextual_link = FALSE and are only consumed through
* materio_flag (controllers/routes) and the decoupled Vue app, so flag's native
* entity integration produces nothing visible here. We therefore remove these
* expensive implementations instead of patching flag.module.
*/
function materio_flag_module_implements_alter(&$implementations, $hook) {
$hooks_to_remove = [
// flag_form_alter(): loops all flags on every content entity form
// (node edit) -> main cause of the 504 gateway timeout.
'form_alter',
// flag_entity_view(): builds a flag field render per flag on entity view.
'entity_view',
// flag_entity_build_defaults_alter(): sets max-age=0 per contextual flag.
'entity_build_defaults_alter',
// flag_entity_view_alter(): adds flag metadata to contextual links.
'entity_view_alter',
// flag_entity_extra_field_info(): declares a pseudo-field per flag.
'entity_extra_field_info',
// flag_entity_operation(): adds flag operation links per flag.
'entity_operation',
];
if (in_array($hook, $hooks_to_remove, TRUE) && isset($implementations['flag'])) {
unset($implementations['flag']);
}
}