Revision a8cee257
Added by Assos Assos almost 5 years ago
drupal7/sites/all/modules/media_youtube/media_youtube.file.inc | ||
---|---|---|
24 | 24 |
*/ |
25 | 25 |
function media_youtube_cache_clear($fids) { |
26 | 26 |
$fids = array_keys($fids); |
27 |
$folder = variable_get('youtube_thumb_dir'); |
|
27 | 28 |
|
28 | 29 |
$query = new EntityFieldQuery(); |
29 | 30 |
$results = $query |
30 |
->entityCondition('entity_type', 'file')
|
|
31 |
->propertyCondition('uri', 'youtube:', 'STARTS_WITH')
|
|
32 |
->propertyCondition('fid', $fids)
|
|
33 |
->execute();
|
|
31 |
->entityCondition('entity_type', 'file') |
|
32 |
->propertyCondition('uri', '%' . $folder . '%', 'LIKE')
|
|
33 |
->propertyCondition('fid', $fids) |
|
34 |
->execute(); |
|
34 | 35 |
|
35 |
$files = file_load_multiple(array_keys($results['file'])); |
|
36 |
if (!empty($results)) { |
|
37 |
$files = file_load_multiple(array_keys($results['file'])); |
|
36 | 38 |
|
37 |
foreach ($files as $file) { |
|
38 |
$wrapper = file_stream_wrapper_get_instance_by_uri($file->uri); |
|
39 |
$local_path = $wrapper->getLocalThumbnailPath(); |
|
40 |
file_unmanaged_delete($local_path); |
|
39 |
foreach ($files as $file) { |
|
40 |
foreach (image_styles() as $isid => $style) { |
|
41 |
$path = image_style_url($isid, $file->uri); |
|
42 |
if ($path) { |
|
43 |
image_path_flush($path); |
|
44 |
} |
|
45 |
} |
|
46 |
drupal_set_message(t('Refreshed thumbnail and derivatives for %filename', array('%filename' => $file->filename))); |
|
47 |
} |
|
41 | 48 |
} |
42 | 49 |
} |
Also available in: Unified diff
Weekly update of contrib modules