You are here

function __drush_exif_file_update in Exif 7

Same name and namespace in other branches
  1. 8.2 exif.drush.inc \__drush_exif_file_update()
  2. 8 exif.drush.inc \__drush_exif_file_update()
1 call to __drush_exif_file_update()
drush_exif_update in ./exif.drush.inc
Drush callback;

File

./exif.drush.inc, line 96

Code

function __drush_exif_file_update($type = '') {
  $query = "SELECT n.fid FROM {file_managed} n WHERE n.type = :type";
  $result = db_query($query, array(
    ':type' => $type,
  ));
  $count = 0;
  foreach ($result as $record) {

    // Load the node object from the database
    $file = file_load($record->fid);

    // Resave the node to make exif changes.
    file_save($file);
    $count++;
  }
  drush_log(dt('Updated %count %type files.', array(
    '%count' => $count,
    '%type' => $type,
  )), "ok");
  return $count;
}