I am new to drupal, now I have function get_node_from_rss() which the file is inside mysite\sites\all\modules\node\node_rss\node_from_rss.module the function will update node from the rss link every 1 hour. Now, I dun know how to make this function add to the cron task. Can I run it without using cron.php? I search in google, they something like simple change the function name like get_node_from_rss_cron(), I also putting some code like:
$interval = variable_get('get_node_from_rss_interval', 60 * 60);
if (time() >= variable_get('get_node_from_rss_next_execution', 0)) {
watchdog('get_node_from_rss', 'get_node_from_rss ran');
if (!empty($GLOBALS['wowfi_locamusic_addnode_show_status_message'])) {
drupal_set_message(t('wowfi_locamusic_addnode executed at %time', array('%time' => date_iso8601(time(0)))));
drupal_set_message(t('wowfi_locamusic_addnode executed at %time', array('%time' => date_iso8601(time(0)))));
}
variable_set('wowfi_locamusic_addnode_next_execution', time() + $interval);
}
inside my code, but those still not working for me, Any solution?
get_node_from_rss_cron()
tonode_rss_cron()
andnode_from_rss.module
filename tonode_rss.module
. And don't put your custom module inside core modules.get_node_from_rss_cron()
this is incorrect. Cron Functions should be of formatMODULE_NAME_cron()
. Any hook should follow this format.