Révision d1c64ea8
Ajouté par Assos Assos il y a plus de 6 ans
drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.file_usage.inc | ||
---|---|---|
59 | 59 |
unset($entity_files[$fid]); |
60 | 60 |
} |
61 | 61 |
// There are the same number of files, nothing to do |
62 |
elseif ($entity_files[$fid] == $old_file_count) {
|
|
62 |
elseif ($entity_files[$fid] == $old_file_count) { |
|
63 | 63 |
unset($entity_files[$fid]); |
64 | 64 |
} |
65 | 65 |
// There are more files now, adjust the difference for the greater number. |
... | ... | |
121 | 121 |
/** |
122 | 122 |
* Utility function to get the file count in this entity |
123 | 123 |
* |
124 |
* @param type $entity
|
|
125 |
* @param type $entity_type
|
|
124 |
* @param string or int or object... $entity
|
|
125 |
* @param string or int or object... $entity_type
|
|
126 | 126 |
* @return int |
127 | 127 |
*/ |
128 | 128 |
function media_wysiwyg_entity_field_count_files($entity_type, $entity) { |
... | ... | |
154 | 154 |
/** |
155 | 155 |
* Implements hook_field_attach_delete_revision(). |
156 | 156 |
* |
157 |
* @param type $entity_type
|
|
158 |
* @param type $entity
|
|
157 |
* @param string or int or object... $entity_type
|
|
158 |
* @param string or int or object... $entity
|
|
159 | 159 |
*/ |
160 | 160 |
function media_wysiwyg_field_attach_delete_revision($entity_type, $entity) { |
161 | 161 |
list($entity_id) = entity_extract_ids($entity_type, $entity); |
162 | 162 |
$files = media_wysiwyg_entity_field_count_files($entity_type, $entity); |
163 | 163 |
foreach ($files as $fid => $count) { |
164 | 164 |
if ($file = file_load($fid)) { |
165 |
file_usage_delete($file, 'media', $entity_type , $entity_id, $count);
|
|
165 |
file_usage_delete($file, 'media', $entity_type, $entity_id, $count); |
|
166 | 166 |
} |
167 | 167 |
} |
168 | 168 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules