function social_content_run_import in Social Content 7
Same name and namespace in other branches
- 7.2 social_content.module \social_content_run_import()
Run an import for a particular social content type.
Gathers data from the registered callback (defined in "data_callback").
Parameters
object $social_content_type: The social content type object.
array $settings: The settings array @see social_content_get_settings()
Return value
int|bool The number of posts imported, or FALSE if it failed.
2 calls to social_content_run_import()
- social_content_cron in ./
social_content.module - Implements hook_cron().
- social_content_import_run_form_submit in ./
social_content.admin.inc - Submit handler for social_content_import_run_form().
1 string reference to 'social_content_run_import'
- social_content_cronapi in ./
social_content.module - Implements hook_cronapi().
File
- ./
social_content.module, line 207 - Social Content module.
Code
function social_content_run_import($social_content_type, $settings) {
$data = FALSE;
$langcode = social_content_get_content_type_langcode($social_content_type['content_type']);
$last_id = social_content_get_last_id($social_content_type, $langcode);
$function = $social_content_type['data_callback'];
if (function_exists($function)) {
$data = $function($settings, $last_id);
if (!empty($data)) {
$result = social_content_import_data($data, $social_content_type, $settings, $langcode);
if ($result) {
watchdog('social_content', 'Social content imported !count !type nodes', array(
'!count' => $result,
'!type' => $social_content_type['title'],
), WATCHDOG_INFO);
}
return $result;
}
}
if ($data === FALSE) {
watchdog('social_content', 'Unable to process !social_content_type, unable to fetch feed', array(
'!social_content_type' => $social_content_type['title'],
));
return FALSE;
}
}