- 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.

4.6.x
Dries Buytaert 2005-03-05 11:05:07 +00:00
parent dcf985de21
commit 77f7aa0211
2 changed files with 8 additions and 8 deletions

View File

@ -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;
}

View File

@ -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;
}