Projet

Général

Profil

Révision 29771811

Ajouté par Assos Assos il y a presque 5 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.file_usage.inc
19 19
/**
20 20
 * Implements hook_field_attach_update().
21 21
 *
22
 * @see media_field_attach_insert().
22
 * @see media_field_attach_insert()
23 23
 */
24 24
function media_wysiwyg_entity_update($entity, $entity_type) {
25 25
  _media_wysiwyg_filter_add_file_usage_from_fields($entity_type, $entity);
......
41 41
  // id. This code may assume some things about entities that are only true for
42 42
  // node objects. This should be reviewed.
43 43
  // @TODO this conditional can probably be condensed
44
  if (empty($entity->revision) && empty($entity->old_vid) && empty($entity->is_new) && ! empty($entity->original)) {
44
  if (empty($entity->revision) && empty($entity->old_vid) && empty($entity->is_new) && !empty($entity->original)) {
45 45
    $old_files = media_wysiwyg_entity_field_count_files($entity_type, $entity->original);
46 46
    foreach ($old_files as $fid => $old_file_count) {
47 47
      // Were there more files on the node just prior to saving?
......
50 50
      }
51 51
      if ($old_file_count > $entity_files[$fid]) {
52 52
        $deprecate = $old_file_count - $entity_files[$fid];
53
        // Now deprecate this usage
53
        // Now deprecate this usage.
54 54
        $file = file_load($fid);
55 55
        if ($file) {
56 56
          file_usage_delete($file, 'media', $entity_type, $entity_id, $deprecate);
57 57
        }
58
        // Usage is deleted, nothing more to do with this file
58
        // Usage is deleted, nothing more to do with this file.
59 59
        unset($entity_files[$fid]);
60 60
      }
61
      // There are the same number of files, nothing to do
61
      // There are the same number of files, nothing to do.
62 62
      elseif ($entity_files[$fid] == $old_file_count) {
63 63
        unset($entity_files[$fid]);
64 64
      }
......
84 84
}
85 85

  
86 86
/**
87
 * Parse file references from an entity's text fields and return them as an array.
87
 * Parse file references from an entity's text fields and return as an array.
88 88
 */
89 89
function media_wysiwyg_filter_parse_from_fields($entity_type, $entity) {
90 90
  $file_references = array();

Formats disponibles : Unified diff