function oembed_cache_clear in oEmbed 7
Same name and namespace in other branches
- 8 oembed.module \oembed_cache_clear()
- 7.0 oembed.module \oembed_cache_clear()
Clear the cached oEmbed content for the selected files.
1 string reference to 'oembed_cache_clear'
- oembed_file_operation_info in ./
oembed.file.inc - Implements hook_file_operations().
File
- ./
oembed.module, line 824 - Core functionality for oEmbed
Code
function oembed_cache_clear($fids) {
$fids = array_keys($fids);
$query = new EntityFieldQuery();
$results = $query
->entityCondition('entity_type', 'file')
->propertyCondition('uri', 'oembed:', 'STARTS_WITH')
->propertyCondition('fid', $fids)
->execute();
$files = file_load_multiple(array_keys($results['file']));
foreach ($files as $file) {
$wrapper = file_stream_wrapper_get_instance_by_uri($file->uri);
$url = $wrapper
->getExternalUrl();
$cid = hash('sha256', $url);
cache_clear_all($cid, 'cache_oembed', TRUE);
}
}