diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-11-20 04:33:56 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-11-20 04:33:56 +0000 |
commit | 851a78f532e867f0d5d5b941b2528a475ada4b97 (patch) | |
tree | 97cb9285edbb5066368f8e8f107593266a1a2eb8 /modules/node/node.api.php | |
parent | b4395139b1053032013c1d815be3a60eaf2963f0 (diff) | |
download | brdo-851a78f532e867f0d5d5b941b2528a475ada4b97.tar.gz brdo-851a78f532e867f0d5d5b941b2528a475ada4b97.tar.bz2 |
#898360 by sun, catch: Cache node types - saves 7% in MySQL in sites using memcache for caching backend
Diffstat (limited to 'modules/node/node.api.php')
-rw-r--r-- | modules/node/node.api.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/node/node.api.php b/modules/node/node.api.php index 41dcdcae7..6e215e33a 100644 --- a/modules/node/node.api.php +++ b/modules/node/node.api.php @@ -143,6 +143,38 @@ * module's responsibility to provide appropriate realms to limit access to * unpublished content. * + * Node access records are stored in the {node_access} table and define which + * grants are required to access a node. There is a special case for the view + * operation -- a record with node ID 0 corresponds to a "view all" grant for + * the realm and grant ID of that record. If there are no node access modules + * enabled, the core node module adds a node ID 0 record for realm 'all'. Node + * access modules can also grant "view all" permission on their custom realms; + * for example, a module could create a record in {node_access} with: + * @code + * $record = array( + * 'nid' => 0, + * 'gid' => 888, + * 'realm' => 'example_realm', + * 'grant_view' => 1, + * 'grant_update' => 0, + * 'grant_delete' => 0, + * ); + * drupal_write_record('node_access', $record); + * @endcode + * And then in its hook_node_grants() implementation, it would need to return: + * @code + * if ($op == 'view') { + * $grants['example_realm'] = array(888); + * } + * @endcode + * If you decide to do this, be aware that the node_access_rebuild() function + * will erase any node ID 0 entry when it is called, so you will need to make + * sure to restore your {node_access} record after node_access_rebuild() is + * called. + * + * @see node_access_view_all_nodes() + * @see node_access_rebuild() + * * @param $account * The user object whose grants are requested. * @param $op |