public static function FeedImportSQLHashes::totalHashes in Feed Import 8
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/
src/ FeedImportSQLHashes.php, line 286
Class
- FeedImportSQLHashes
- This class implements SQL hash storage
Namespace
Drupal\feed_import_baseCode
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;
}