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?

Comments

aether created an issue. See original summary.

aether’s picture

Issue summary: View changes
aether’s picture

Status: Active » Needs review
StatusFileSize
new7.71 KB

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

  • rickyoh committed 7d70653 on 7.x-2.x authored by aether
    Issue #2681395 by aether: node_access table truncated when used with...
rickyoh’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.