Projet

Général

Profil

Révision 39a181a4

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/link/link.install
6 6
 */
7 7

  
8 8
/**
9
 * Upgrade notes:
10
 * Things we need to make sure work when upgrading from Drupal 6 to Drupal 7:
9
 * Upgrade notes.
10
 *
11
 * Things we need to make sure work when upgrading from Drupal 6 to Drupal 7:.
11 12
 */
12 13

  
14
/**
15
 * Implements hook_uninstall().
16
 */
17
function link_install() {
18
  // Notify the user they may want to install token.
19
  if (!module_exists('token')) {
20
    $t = get_t();
21
    drupal_set_message($t('If you install the <a href="!url" target="blank">Token</a>, static title can use any other entity field as its value.', array(
22
      '!url' => 'http://drupal.org/project/token',
23
    )));
24
  }
25
}
26

  
27
/**
28
 * Removes unused link_extra_domains variable.
29
 */
30
function link_update_7002() {
31
  variable_del('link_extra_domains');
32
}
33

  
34
/**
35
 * Implements hook_uninstall().
36
 */
37
function link_uninstall() {
38
  variable_del('link_allowed_domains');
39
}
40

  
13 41
/**
14 42
 * Implements hook_field_schema().
15 43
 */
......
46 74
}
47 75

  
48 76
/**
49
 * Handles moving settings data from field_config.data to field_config_instance.data.
77
 * Implements hook_update_N().
78
 *
79
 * Handles moving settings data from field_config.data to
80
 * field_config_instance.data.
50 81
 */
51 82
function link_update_7000() {
52
  
53
  // For each field that is a link field, we need to copy the settings from the general field level down to the instance.
54
  //$field_data = array();
83

  
84
  // For each field that is a link field, we need to copy the settings from the
85
  // general field level down to the instance.
55 86
  $result = db_query("SELECT id, field_name, data FROM {field_config} WHERE module = 'link' AND type = 'link_field'");
56 87
  foreach ($result as $field) {
57
    $field_id = $field->id;
58
    $name = $field->field_name;
88

  
59 89
    $field_data = unserialize($field->data);
60
    
61
    $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field_id));
90

  
91
    $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field->id));
62 92
    foreach ($instances as $instance) {
63 93
      // If this field has been updated already, we want to skip it.
64 94
      $instance_data = unserialize($instance->data);
......
71 101
          }
72 102
        }
73 103
        if ($update_instance) {
74
          // update the database.
75
          $num_updated = db_update('field_config_instance')
104
          // Update the database.
105
          db_update('field_config_instance')
76 106
            ->fields(array('data' => serialize($instance_data)))
77 107
            ->condition('id', $instance->id)
78 108
            ->execute();
......
80 110
      }
81 111
    }
82 112
  }
83
  
113

  
84 114
  return t("Instance settings have been set with the data from the field settings.");
85 115
}
86 116

  
87 117
/**
88
 * Renames all displays from foobar to link_foobar
118
 * Renames all displays from foobar to link_foobar.
89 119
 */
90 120
function link_update_7001() {
91 121
  // Update the display type for each link field type.
92 122
  $result = db_query("SELECT id, field_name, data FROM {field_config} WHERE module = 'link' AND type = 'link_field'");
93 123
  foreach ($result as $field) {
94
    $field_id = $field->id;
95
    $name = $field->field_name;
96
    $field_data = unserialize($field->data);
97
    
98
    $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field_id));
124

  
125
    $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field->id));
99 126
    foreach ($instances as $instance) {
100 127
      // If this field has been updated already, we want to skip it.
101 128
      $instance_data = unserialize($instance->data);

Formats disponibles : Unified diff