calais_bulk_process = TRUE; $threshold = variable_get("calais_threshold_{$node->type}", 0.01); calais_process_node($node, $process_type, $threshold, 'update'); // It's nice to give Calais's poor servers a break in between processing. if ($throttle) { usleep(100000); } } // Update the last node imported and provide status report. variable_set('calais_bulk_import_last_processed', $node->nid); $remaining = db_result(db_query("SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {calais_term_node} c ON n.nid = c.nid WHERE n.type IN ('%s') AND n.nid < %d AND c.nid IS NULL" , implode("','", $valid_types), $node->nid)); if ($remaining == 0) { // We're done! Hooray!! variable_set('calais_bulk_import_nodes_completed', TRUE); } print t('Processed through record @record. @remaining remaining.', array('@record' => $node->nid, '@remaining' => $remaining)); // Clear the caches. Ouch. :( cache_clear_all(); }