You are here

public static function FeedImportSQLHashes::totalHashes in Feed Import 7.3

Returns total number of hashes for desired feeds.

Parameters

mixed $name: The feed machine name (array for multiple) or NULL for all.

Return value

mixed $name Number of hashes (groupped by name for multiple)

Overrides FeedImportStaticHashManager::totalHashes

File

feed_import_base/inc/feed_import.inc, line 2041
This file contains Feed Import helpers.

Class

FeedImportSQLHashes
This class implements SQL hash storage

Code

public static function totalHashes($name = NULL) {
  $q = db_select('feed_import_hashes', 'f')
    ->fields('f', array(
    'feed_machine_name',
  ));
  if ($name) {
    $q
      ->condition('feed_machine_name', $name);
  }
  $q
    ->addExpression('COUNT(*)', 'cnt');
  $q = $q
    ->groupBy('feed_machine_name')
    ->execute()
    ->fetchAllKeyed();
  if ($name && is_scalar($name)) {
    return isset($q[$name]) ? $q[$name] : 0;
  }
  return $q;
}