You are here

function drush_exif_update in Exif 8

Same name and namespace in other branches
  1. 8.2 exif.drush.inc \drush_exif_update()
  2. 7 exif.drush.inc \drush_exif_update()

Implements Drush callback.

File

./exif.drush.inc, line 83
Drush extension allowing to run some tasks related to exif.

Code

function drush_exif_update($entity_type = '', $type = '') {
  $entity_types = __check_entity_type($entity_type);
  if (count($entity_types) == 0) {
    drush_log(dt('invalid entity type %type.', [
      '%type' => $entity_type,
    ]), "error");
    return;
  }
  $selected_types = __check_bundle($entity_types, $type);
  if (count($selected_types) == 0) {
    drush_log(dt('invalid type %type.', [
      '%type' => $type,
    ]), "error");
    return;
  }
  drush_log(dt('Need to update %count types.', [
    '%count' => count($selected_types),
  ]));
  foreach ($selected_types as $type) {
    if ($type['entity'] == 'node') {
      $count = __drush_exif_node_update($type['type']);
    }
    if ($type['entity'] == 'file') {
      $count = __drush_exif_file_update($type['type']);
    }
    if ($type['entity'] == 'media') {
      $count = __drush_exif_media_update($type['type']);
    }
  }
}