[drupal-devel] rewrite node queries
I just committed chx's node query rewrite patch. If your module queries the node table, you might want to look into issue #14731 (http://drupal.org/node/14731) and update your module accordingly. In short, you should no longer use node_access_join_sql() or node_access_where_sql() but wrap your query in a call to node_rewrite_sql(). I hope chx will update the upgrade-page in the module developers guide. -- Dries Buytaert :: http://www.buytaert.net/
Dries Buytaert wrote:
I just committed chx's node query rewrite patch. If your module queries the node table, you might want to look into issue #14731 (http://drupal.org/node/14731) and update your module accordingly.
In short, you should no longer use node_access_join_sql() or node_access_where_sql() but wrap your query in a call to node_rewrite_sql().
I hope chx will update the upgrade-page in the module developers guide.
Chx sent me a snippet which I added to the upgrade guide (after I made some modifications): http://drupal.org/node/12347. -- Dries Buytaert :: http://www.buytaert.net/
I just committed chx's node query rewrite patch. If your module queries the node table, you might want to look into issue #14731 (http://drupal.org/node/14731) and update your module accordingly.
In short, you should no longer use node_access_join_sql() or node_access_where_sql() but wrap your query in a call to node_rewrite_sql().
I hope chx will update the upgrade-page in the module developers guide.
Chx sent me a snippet which I added to the upgrade guide (after I made some modifications): http://drupal.org/node/12347.
Seems like implementing node level permissions in contributed modules got a lot easier :) Goba
Op maandag 17 januari 2005 20:08, schreef Gabor Hojtsy:
Seems like implementing node level permissions in contributed modules got a lot easier :)
Seems like i18n requires a lot lot less patches to core now too ;) -- Regards, Bèr -- [ Bèr Kessels | Drupal services www.webschuur.com ]
In short, you should no longer use node_access_join_sql() or node_access_where_sql() but wrap your query in a call to node_rewrite_sql().
I hope chx will update the upgrade-page in the module developers guide.
I think that you only have to rewrite queries that return a *list* of nodes. Queries that go after a single node need not be wrapped in node_rewrite_sql() ... or i'm mistaken ...
I think that you only have to rewrite queries that return a *list* of nodes. Queries that go after a single node need not be wrapped in node_rewrite_sql() ... or i'm mistaken ...
I have similar thoughts. I have not rewritten node_load because of this. But even I am not really convinced -- for example, I am not sure what happens if someone just types node/123456. Will this request go through all the implemenations of hook_node_rewrite_sql (among them the old node_access_*_sql calls)? Is it needed?
I think that you only have to rewrite queries that return a *list* of nodes. Queries that go after a single node need not be wrapped in node_rewrite_sql() ... or i'm mistaken ...
I have similar thoughts. I have not rewritten node_load because of this. But even I am not really convinced -- for example, I am not sure what happens if someone just types node/123456. Will this request go through all the implemenations of hook_node_rewrite_sql (among them the old node_access_*_sql calls)? Is it needed?
Permissions need to be checked somewhere, and I guess a language needs to be selected on node_load() too. Goba
From node/12347 last line: ..."this way nid can be replaced with DISTINCT(nid) should there be a need for it." maybe should read: this way the node_rewrite_sql() function can rewrite the query to use DISTINCT(nid) should there be a need for it. This adds clarity to those that aren't familiar with the recent changes. I would edit the handbook myself - but edit option is gone from handbook again. andre Dries Buytaert wrote:
Dries Buytaert wrote:
I just committed chx's node query rewrite patch. If your module queries the node table, you might want to look into issue #14731 (http://drupal.org/node/14731) and update your module accordingly.
In short, you should no longer use node_access_join_sql() or node_access_where_sql() but wrap your query in a call to node_rewrite_sql().
I hope chx will update the upgrade-page in the module developers guide.
Chx sent me a snippet which I added to the upgrade guide (after I made some modifications): http://drupal.org/node/12347.
last line: ..."this way nid can be replaced with DISTINCT(nid) should there be a need for it."
maybe should read:
this way the node_rewrite_sql() function can rewrite the query to use DISTINCT(nid) should there be a need for it.
This adds clarity to those that aren't familiar with the recent changes. I would edit the handbook myself - but edit option is gone from handbook again.
I have just fixed the description as you suggested. Goba
participants (6)
-
Andre Molnar -
Bèr Kessels -
Dries Buytaert -
Gabor Hojtsy -
Moshe Weitzman -
Negyesi Karoly