function social_content_cronapi in Social Content 7
Same name and namespace in other branches
- 7.2 social_content.module \social_content_cronapi()
Implements hook_cronapi().
Elysia cron hook. Split all social content imports into their own jobs for elysia cron. Stagger the time by five minutes for each run.
File
- ./
social_content.module, line 159 - Social Content module.
Code
function social_content_cronapi($op, $job = NULL) {
$items = array();
$mins = 0;
foreach (social_content_get_types() as $social_content_type) {
$settings = social_content_get_settings($social_content_type);
if ($settings['enabled']) {
$mins += 5;
if ($mins > 60) {
$mins -= 60;
}
$items['social_content_' . $social_content_type['name']] = array(
'description' => t('Social content import for !title', array(
'!title' => $social_content_type['title'],
)),
'rule' => $mins . ' */2 * * *',
'callback' => 'social_content_run_import',
'arguments' => array(
$social_content_type,
$settings,
),
);
}
}
return $items;
}