You are here

public static function FeedImport::entityDelete in Feed Import 7

Same name and namespace in other branches
  1. 7.2 feed_import.inc.php \FeedImport::entityDelete()

Delete entity by type and ids

Parameters

string $type: Entity type (node, user, ...)

array $ids: Array of entity ids

Return value

array Array of deleted ids

1 call to FeedImport::entityDelete()
feed_import_delete_items in ./feed_import.module
Delete feed items and set report

File

./feed_import.inc.php, line 307
Feed import class for parsing and processing content

Class

FeedImport
@file Feed import class for parsing and processing content

Code

public static function entityDelete($type, $ids) {
  $func = $type . '_delete_multiple';
  if (function_exists($func)) {
    try {
      call_user_func($func, $ids);
    } catch (Exception $e) {
      return array();
    }
    return $ids;
  }
  else {
    $func = $type . '_delete';
    if (function_exists($func)) {
      foreach ($ids as $k => &$id) {
        try {
          call_user_func($func, $id);
        } catch (Exception $e) {
          unset($ids[$k]);
        }
      }
      return $ids;
    }
  }
  unset($type, $ids);
  return array();
}