Projet

Général

Profil

Révision d50a36e0

Ajouté par Assos Assos il y a presque 4 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/fivestar/fivestar.install
2 2

  
3 3
/**
4 4
 * @file
5
 * Installation file for fivestar module.
5
 * Install, update, and uninstall functions the Fivestar module.
6 6
 */
7 7

  
8
/**
9
 * Implements hook_uninstall().
10
 */
8 11
function fivestar_uninstall() {
9 12
  db_query("DELETE FROM {variable} WHERE name LIKE 'fivestar_%'");
10 13
}
11 14

  
12 15
/**
13
 * hook_field_schema().
16
 * Hook_field_schema().
14 17
 */
15 18
function fivestar_field_schema() {
16 19
  return array(
......
19 22
        'type' => 'int',
20 23
        'unsigned' => TRUE,
21 24
        'not null' => FALSE,
22
        'sortable' => TRUE
25
        'sortable' => TRUE,
23 26
      ),
24 27
      'target' => array(
25 28
        'type' => 'int',
26 29
        'unsigned' => TRUE,
27
        'not null' => FALSE
30
        'not null' => FALSE,
28 31
      ),
29 32
    ),
30 33
  );
31 34
}
32 35

  
33 36
/**
34
 * Fixes the axis value stored for fivestar fields
37
 * Fixes the axis value stored for fivestar fields.
35 38
 */
36 39
function fivestar_update_7201() {
37 40
  drupal_load('module', 'fivestar');
......
46 49
}
47 50

  
48 51
/**
49
 * Moves the field settings to field instance settings
52
 * Moves the field settings to field instance settings.
50 53
 */
51 54
function fivestar_update_7202() {
52 55
  $fields = field_read_fields(array('module' => 'fivestar'));
......
60 63
  }
61 64
}
62 65

  
63

  
64 66
/**
65
 * Convert all existing fivestar/node_type settings into fields with exposed fivestar formatters
67
 * Converts all existing fivestar/node_type settings into fields with exposed fivestar formatters.
66 68
 */
67 69
function fivestar_update_7203() {
68
  // Gather the node types
70
  // Gather the node types.
69 71
  $query = db_select('node_type', 'n');
70 72
  $query->addField('n', 'type');
71 73
  $result = $query->execute();
......
108 110
      );
109 111

  
110 112
      if (variable_get('fivestar_' . $var_suffix, FALSE)) {
111
        // Check to see if a field for this tag exists and create one if needed
113
        // Check to see if a field for this tag exists and create one if needed.
112 114
        $field_name = 'field_' . $tag;
113 115
        $field = field_read_field($field_name . $suffix, array('include_deleted' => TRUE));
114 116

  
......
129 131
          $field = field_create_field($field_values);
130 132
        }
131 133

  
132
        // Create an instance of the field in this bundle
134
        // Create an instance of the field in this bundle.
133 135
        $instance = field_read_instance('node', $field['field_name'], $type, array('include_deleted' => TRUE));
134 136
        if (empty($instance)) {
135 137
          $instance_info = array(
......
168 170
    }
169 171
  }
170 172

  
171
  // Rebuild the menu to remove the node type tag form paths
173
  // Rebuild the menu to remove the node type tag form paths.
172 174
  menu_rebuild();
173 175
  _field_info_collate_fields(TRUE);
174 176
}
175 177

  
176 178
/**
177
 * Preserve settings from fivestar_formatter_exposed_stars and convert to
178
 * fivestar_formatter_default.
179
 * Preserve settings from fivestar_formatter_exposed_stars and convert to fivestar_formatter_default.
179 180
 */
180 181
function fivestar_update_7204() {
181 182
  $fields = field_read_fields(array('type' => 'fivestar'));
......
203 204
          }
204 205
        }
205 206
      }
206
      // Update the instance
207
      // Update the instance.
207 208
      field_update_instance($instance);
208 209
    }
209 210
  }
210 211
}
211 212

  
212 213
/**
213
 * Rename fivestar 'select' widget to 'fivestar_select'
214
 * Rename fivestar 'select' widget to 'fivestar_select'.
215
 *
214 216
 * @see http://drupal.org/node/1285456
215 217
 */
216 218
function fivestar_update_7205() {
......
222 224
      // If the widget type is select, lets change it.
223 225
      if ($instance['widget']['type'] == 'select') {
224 226
        $instance['widget']['type'] = 'fivestar_select';
225
        // Update the instance
227
        // Update the instance.
226 228
        field_update_instance($instance);
227 229
      }
228 230
    }
......
230 232
}
231 233

  
232 234
/**
233
 * Preserve setting after new feature preventing re-votes
235
 * Preserve setting after new feature preventing re-votes.
236
 *
234 237
 * @see http://drupal.org/node/356605
235 238
 */
236 239
function fivestar_update_7206() {
......
241 244
    foreach ($instances as $instance) {
242 245
      // The default should be to allow re-voting.
243 246
      $instance['settings']['allow_revote'] = TRUE;
244
        // Update the instance
245
        field_update_instance($instance);
247
      // Update the instance.
248
      field_update_instance($instance);
246 249
    }
247 250
  }
248 251
}
249 252

  
250 253
/**
251
 * Preserve setting after new feature preventing own votes
254
 * Preserve setting after new feature preventing own votes.
255
 *
252 256
 * @see http://drupal.org/node/189527
253 257
 */
254 258
function fivestar_update_7207() {
......
259 263
    foreach ($instances as $instance) {
260 264
      // The default should be to allow own votes.
261 265
      $instance['settings']['allow_ownvote'] = TRUE;
262
        // Update the instance
263
        field_update_instance($instance);
266
      // Update the instance.
267
      field_update_instance($instance);
264 268
    }
265 269
  }
266 270
}
267 271

  
268 272
/**
269 273
 * Change field formatters to ensure unique.
274
 *
270 275
 * @see http://drupal.org/node/1063754
271 276
 */
272 277
function fivestar_update_7208() {

Formats disponibles : Unified diff