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.
If no node_access modules are enabled, we don't need to query the node grants table.
Saves a query on the front page.
Comment | File | Size | Author |
---|---|---|---|
#6 | node_access.patch | 675 bytes | catch |
#2 | node_access.patch | 1.58 KB | catch |
node_access.patch | 698 bytes | catch | |
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedGood catch :)
The current code uses a static because
node_access_view_all_nodes()
can potentially be called several times on a given page. Let's move the module_implements() check inside theif (!isset($access))
, to avoid calling it several times.Comment #2
catchThat's a good point, re-rolled.
Comment #3
Damien Tournoud CreditAttribution: Damien Tournoud commentedok, let's kill one query.
Comment #4
Dries CreditAttribution: Dries commentedGood catch, indeed. Committed to CVS HEAD. Thanks.
Comment #6
catchHere's a backport for D6, added an early return in this case since I'm not sure if it'll be considered for 6, but it works the same.
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedI'm going to guess this is a won't fix for D6, since D6 commits focus on security fixes at this point.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedChanging issue status to reflect that it was fixed in 7.x.
Comment #9
hefox CreditAttribution: hefox commentedd6 has non-security related fixes still, tmk, specially for issues like performance.
Only things not backportable are api changes, and this isn't an api change
It looks good to me, but only eye-balled it.
Note that this query still will be done when rewritting node queries if user has administer nodes permission, not sure about d7 and bypass node access. Opening a new issue for that, as api wise according to the documentation this function is specially to see if the user has that global grant, and not if the user can view all nodes.
Comment #10
hefox CreditAttribution: hefox commented