When performing an import, the node_access table gets truncated when the site employs any module that implements hook_node_grants(). This is due to the following line in cloudwords_import_batch_finished():
//negate unpublished node access granted to scraper
node_access_rebuild(true);
The problem is that setting the $batch_mode flag to TRUE on node_access_rebuild() tells it to rebuild the node_access table using a batch process if there are any modules that implement hook_node_grants(). This batch process will never kick off however as node_access_rebuild() is being called in the Cloudwords import batch success callback, which is not a viable context to kick off another batch process. So node_access_rebuild() truncates node_access but is never able to rebuild it which obviously has really bad consequences.
The deeper question here is if node_access_rebuild() is even necessary. From what I can tell, the scraper is given view access to the node using hook_node_access() which does not modify the node_access table. Is there someplace that I'm missing where the node_access table is modified and therefore requires a rebuild?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | cloudwords_dont-rebuild-node-access-2681395-3.patch | 7.71 KB | aether |
Comments
Comment #2
aether commentedComment #3
aether commentedThe node access table also gets truncated when creating a project. I don't see a need for rebuilding the node_access table at all. This patch removes both calls to node_access_rebuild(). Patch also includes some whitespace cleanup.
Comment #5
rickyoh commented