Node Updates On Cron

Events happening in the community are now at Drupal community events on www.drupal.org.
mtbosworth's picture

Here is my problem. I am building a set of modules to sync remote objects from another server with nodes in Drupal. The particular module that I am finishing is backup mechanism in the case the remote server is not responding. The data is stored and the calls are rerun when the service is back up. This happens during cron. When a call comes back it returns a unique identifier for the object that I need to store in the node that is associated with it. My problem is that both node_save and db_query are failing to update existing nodes.

I have found some people with a similar issue here:
http://drupal.org/node/52981

Any thoughts?

Comments

Here's what I'm doing

jarodms's picture

Here's what I'm doing during a cron run that works for me. In my case I'm not using revisions.

$node = node_load($nid, NULL, TRUE);

// Update my CCK field
$node->field_total_sqft[0]['value'] = 1000;

node_save($node);

Do you get a specific error during the save?

Right

mtbosworth's picture

That's what my code looks like. I tried to dd() the output of mysql_error() right after node_save, but it returned an empty string. Nothing in watchdog.

Mike Bosworth
Balanced Scale Media, LLC
balancedscale.com

Solution

mtbosworth's picture

Made sure revisions were off. Used node_load($nid, NULL, TRUE); instead of node_load($nid);.

Rock.

Mike Bosworth
Balanced Scale Media, LLC
balancedscale.com

Central Iowa Drupal Users Group

Group categories

Category

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: