Module breaks search index phase of cron

mrothroc - April 17, 2009 - 05:25
Project:Community Tags
Version:6.x-1.0-beta1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

The module appears to break cron during the "build search index" phase. I traced through the code and it seems that it fails during the "view" clause of hook_nodeapi which is called during the indexing. In my case, cron.php is called by Unix cron, so the node is being accessed by an anonymous user. From what I see of the code, it expects a user.

I modified line 210 to work around the problem. Unmodified, it said this:
if (!$teaser && $node->community_tags_form) {

Post modification, it now says this:
if (!$teaser && $node->community_tags_form && $user->uid) {

This fixes the problem for me. In my case I don't allow Anonymous to tag nodes, meaning that though this works for me it doesn't solve the general case. Thus, no patch, knowing that it would be rejected. I welcome community discussion of the correct approach and, if I understand it, I'll be happy to roll a patch.

 
 

Drupal is a registered trademark of Dries Buytaert.