Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
metatag_entity_load()
uses metatag_entity_supports_metatags()
for querying entities metatags instances, but it could reduce the $revision_ids
by first checking if the bundles are enabled, thus potentially reducing the number of SQL queries.
Comment | File | Size | Author |
---|---|---|---|
#18 | metatag-n2070821-18.patch | 40.97 KB | DamienMcKenna |
Comments
Comment #1
pounardFor example, the given patch applied on a module where lives something like 50 node types but only 4 of them are enabled to use metatags (using hook_entity_info_alter()) saves us an average of 30 SQL queries per page, which is significant.
Comment #2
pounardAnd here is a patch for the current version.
Patch has been done with a manual diff, so you need to:
manually to apply. Drush make will apply cleanly.
Comment #3
DamienMcKennaComment #4
DamienMcKenna@pounard: Thanks for the patch. I've made a few minor tweaks.
Comment #5
pounardLooks good to me, glad I could help.
Comment #6
DamienMcKennaRerolled.
Comment #7
DamienMcKennaRerolled.
Comment #8
DamienMcKennaThis needs work.
Comment #9
DamienMcKennaComment #12
DamienMcKennaWhile I was rerolling this patch I realized something: A lot of work was being done to deal with the fact that you have to change the API of an entity to indicate it's supported by Metatag, and then there's a settings page which lets you control which one of those entity types is actually enabled. And then there was a whole extra function / internal API for deciding whether entity types should be disabled anyway. And if there wasn't an enabled global configuration for a specific entity there was no way of supporting that entity. It was all a little confusing.
So I've simplified this whole system:
Please let me know what you think!
Comment #13
DamienMcKennaSome minor adjustments - I accidentally renamed the "Advanced settings" fieldset on the (newly renamed) settings page, and improved the entity type settings' description a little on that page.
Comment #16
DamienMcKennaThe tests pass locally but fail on testbot :(
Comment #17
DamienMcKennaWell, if I upload the same patch twice then no wonder it fails ;-) Also, I'd accidentally created the patches in the wrong location, so the patch in #12 wasn't the correct one to start with.
*This* is the correct patch file.
Comment #18
DamienMcKennaThis removes hook_entity_info_alter() entirely, clears the caches at the end of the update script and adds another update script to clear the menu cache because the 'advanced settings' page was renamed to just 'settings'.
Comment #20
DamienMcKennaCommitted. I'll need to do a change notice for this.
Comment #21
DamienMcKennaI've written up a change notice: https://www.drupal.org/node/2495819
Comment #22
pounardIt took quite some time, but thank you very much for commiting this.