If cron is run in context of anonymous user and node_access denies node deletion to anonymous user then node_delete silently fails and the node is not deleted.

The source code for node_delete confirms this.

Most sites do not grant node deletion perms to anonymous users, so I would expect this to be a widespread problem.

Per http://drupal.org/node/28142, node_delete can be used from cron if the module performs a user 'switch' before calling node_delete. Seems funky, but I don't know a better way to do it given the current state of node_delete on deployed drupal servers.

Comments

jeremy’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Assigned: Unassigned » jeremy
Status: Active » Fixed

Fixed in latest development branch.

mcurry’s picture

Looking at that commit, I see no mods to the module source file - missed a file? :D Or am I misreading the commit notes?

jeremy’s picture

Yeah, sorry, the change was committed in another commit. I caught it just before branching for the 5.x-1.1 release.

mcurry’s picture

Ok, thanks for fixing this issue. Much appreciated!

Anonymous’s picture

Status: Fixed » Closed (fixed)