From 77f7aa0211ee7682a2fcf4c9544be962e727f719 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Sat, 5 Mar 2005 11:05:07 +0000
Subject: [PATCH] - Patch #18418 by chx: jonbob node_access_view_all patch
 changed the return value of node_access_where_sql to empty which breaks
 nicely all queries which are still using this function. This is a good
 incentive to upgrade to db_rewrite_sql, yes, but I think it causes confusion,
 'cos it is not really trivial why the query suddenly not works. Let's make it
 trivial -- rename it _node_access_where_sql, it is no longer a function to be
 called from outside. node_access_join_sql similarly.

---
 modules/node.module      | 8 ++++----
 modules/node/node.module | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/modules/node.module b/modules/node.module
index ceccb5f3fc18..ab2b4c876898 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -1887,7 +1887,7 @@ function node_access($op, $node = NULL, $uid = NULL) {
  * @return
  *   An SQL join clause.
  */
-function node_access_join_sql($node_alias = 'n', $node_access_alias = 'na') {
+function _node_access_join_sql($node_alias = 'n', $node_access_alias = 'na') {
   if (user_access('administer nodes')) {
     return '';
   }
@@ -1906,7 +1906,7 @@ function node_access_join_sql($node_alias = 'n', $node_access_alias = 'na') {
  * @return
  *   An SQL where clause.
  */
-function node_access_where_sql($op = 'view', $node_access_alias = 'na', $uid = NULL) {
+function _node_access_where_sql($op = 'view', $node_access_alias = 'na', $uid = NULL) {
   if (user_access('administer nodes')) {
     return;
   }
@@ -1977,8 +1977,8 @@ function node_access_view_all_nodes() {
  */
 function node_db_rewrite_sql($query, $primary_table, $primary_field) {
   if ($primary_field == 'nid' && !node_access_view_all_nodes()) {
-    $return['join'] = node_access_join_sql();
-    $return['where'] = node_access_where_sql();
+    $return['join'] = _node_access_join_sql();
+    $return['where'] = _node_access_where_sql();
     $return['distinct'] = 1;
     return $return;
   }
diff --git a/modules/node/node.module b/modules/node/node.module
index ceccb5f3fc18..ab2b4c876898 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1887,7 +1887,7 @@ function node_access($op, $node = NULL, $uid = NULL) {
  * @return
  *   An SQL join clause.
  */
-function node_access_join_sql($node_alias = 'n', $node_access_alias = 'na') {
+function _node_access_join_sql($node_alias = 'n', $node_access_alias = 'na') {
   if (user_access('administer nodes')) {
     return '';
   }
@@ -1906,7 +1906,7 @@ function node_access_join_sql($node_alias = 'n', $node_access_alias = 'na') {
  * @return
  *   An SQL where clause.
  */
-function node_access_where_sql($op = 'view', $node_access_alias = 'na', $uid = NULL) {
+function _node_access_where_sql($op = 'view', $node_access_alias = 'na', $uid = NULL) {
   if (user_access('administer nodes')) {
     return;
   }
@@ -1977,8 +1977,8 @@ function node_access_view_all_nodes() {
  */
 function node_db_rewrite_sql($query, $primary_table, $primary_field) {
   if ($primary_field == 'nid' && !node_access_view_all_nodes()) {
-    $return['join'] = node_access_join_sql();
-    $return['where'] = node_access_where_sql();
+    $return['join'] = _node_access_join_sql();
+    $return['where'] = _node_access_where_sql();
     $return['distinct'] = 1;
     return $return;
   }
-- 
GitLab