function feed_import_delete_items in Feed Import 7
Same name and namespace in other branches
- 7.2 feed_import.module \feed_import_delete_items()
Delete feed items and set report
Parameters
array &$items: Array of entity ids keyed by entity type
1 call to feed_import_delete_items()
- feed_import_cron in ./
feed_import.module - Implements hook_cron().
File
- ./
feed_import.module, line 316 - User interface, cron functions for feed_import module
Code
function feed_import_delete_items(&$items) {
$start = time();
$ids = array();
// Get deleted ids
foreach ($items as $type => &$value) {
$value = FeedImport::entityDelete($type, $value);
if (!isset($ids[$type])) {
$ids[$type] = $value;
}
else {
$ids[$type] += $value;
}
$value = NULL;
}
unset($items);
if (empty($ids)) {
return;
}
// Delete items from feed_import_hashes
FeedImport::deleteItemsbyEntityId($ids);
// Count deleted items for each entity
foreach ($ids as $type => &$id) {
$id = count($id) . ' ' . $type . ' ' . t('items');
}
$ids = implode(', ', $ids);
// Set report message only if we deleted items
$msg = 'Deleted %items. Started %started, duration %time';
$info = array(
'%items' => $ids,
'%started' => date('d/m/Y H:i:s', $start),
'%time' => gmdate('H:i:s', time() - $start),
);
watchdog('feed_import_info', $msg, $info);
}