Same name and namespace in other branches
- 8.x-2.x exif.drush.inc \__drush_exif_media_update() 1 comment
Parameters
string $type:
Return value
int
1 call to __drush_exif_media_update()
- drush_exif_update in ./
exif.drush.inc - Implements Drush callback.
File
-
./
exif.drush.inc, line 338
Code
function __drush_exif_media_update($type = '') {
$query = "SELECT m.mid FROM {media} m WHERE m.bundle = :type";
// TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
// You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
$result = \Drupal::database()->query($query, [
':type' => $type,
]);
$count = 0;
foreach ($result as $record) {
// Load the media object from the database.
$media = Media::load($record->mid);
// Resave the media to make exif changes.
$media->save();
$count++;
}
drush_log(dt('Updated %count %type medias.', [
'%count' => $count,
'%type' => $type,
]), "ok");
return $count;
}