Same name and namespace in other branches
- 7.x-1.x exif.drush.inc \__drush_exif_file_update() 1 comment
- 8.x-1.x exif.drush.inc \__drush_exif_file_update() 1 comment
The drush file update.
Parameters
string $type: The type.
Return value
int Returns The $count;
Throws
\Drupal\Core\Entity\EntityStorageException
1 call to __drush_exif_file_update()
- drush_exif_update in ./
exif.drush.inc - Implements Drush callback.
File
-
./
exif.drush.inc, line 325
Code
function __drush_exif_file_update($type = '') {
$query = "SELECT n.fid FROM {file_managed} n WHERE n.type = :type";
$result = \Drupal::database()->query($query, [
':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();
$count++;
}
\Drupal::logger(dt('Updated %count %type files.', [
'%count' => $count,
'%type' => $type,
]));
return $count;
}