diff -u modules/field/field.install 2011-01-11 14:05:49 +0000 modules/field/field.install --- modules/field/field.install 2011-01-11 14:05:49 +0000 +++ modules/field/field.install @@ -310,19 +310,22 @@ /** * Utility function: fetch all the field definitions from the database. * + * Warining: unlike the field_read_fields() API function, this function returns + * all fields by default, including deleted and inactive fields, unless + * specified otherwise in the $conditions parameter. + * * @param $conditions * An array of conditions to limit the select query to. - * @param $key - * The name of the field property the return array is indexed by. + * + * @return + * An array of fields matching $conditions, keyed by field id. */ -function _update_7000_field_read_fields(array $conditions = array(), $key = 'id') { +function _update_7000_field_read_fields(array $conditions = array()) { $fields = array(); $query = db_select('field_config', 'fc', array('fetch' => PDO::FETCH_ASSOC)) ->fields('fc'); - if (!empty($conditions)) { - foreach ($conditions as $column => $value) { - $query->condition($column, $value); - } + foreach ($conditions as $column => $value) { + $query->condition($column, $value); } foreach ($query->execute() as $record) { $field = unserialize($record['data']); @@ -339,7 +342,7 @@ $field['translatable'] = $record['translatable']; $field['deleted'] = $record['deleted']; - $fields[$field[$key]] = $field; + $fields[$field['id']] = $field; } return $fields; } diff -u modules/field/modules/list/list.install 2011-01-11 14:07:01 +0000 modules/field/modules/list/list.install --- modules/field/modules/list/list.install 2011-01-11 14:07:01 +0000 +++ modules/field/modules/list/list.install @@ -118,0 +119,12 @@ + +/** + * Re-apply list_update_7001() for deleted fields. + */ +function list_update_7002() { + // See http://drupal.org/node/1022924: list_update_7001() intitally + // overlooked deleted fields, which then caused fatal errors when the fields + // were being purged. + // list_update_7001() has the required checks to ensure it is reentrant, so + // it can simply be executed once more.. + list_update_7001(); +} \ Pas de fin de ligne à la fin du fichier. diff -u modules/taxonomy/taxonomy.install 2011-01-11 14:06:04 +0000 modules/taxonomy/taxonomy.install --- modules/taxonomy/taxonomy.install 2011-01-11 14:06:04 +0000 +++ modules/taxonomy/taxonomy.install @@ -568,7 +568,7 @@ // provides the delta value for each term reference data insert. The // deltas are reset for each new revision. - $field_info = _update_7000_field_read_fields(array('deleted' => 0), 'field_name'); + $field_info = _update_7000_field_read_fields(array('type' => 'taxonomy_term_reference')); // This is a multi-pass update. On the first call we need to initialize some // variables. @@ -641,7 +641,15 @@ // Use the valid field for this vocabulary and node type or use the // overflow vocabulary if there is no valid field. $field_name = isset($sandbox['vocabularies'][$record->vocab_id][$record->type]) ? $sandbox['vocabularies'][$record->vocab_id][$record->type] : 'taxonomyextra'; - $field = $field_info[$field_name]; + + // $field_info is keyed by field id. Iterate until we find the right + // field. Matching on field name only is safe, since there will be no + // deleted field at this point of the upgrade path. + foreach ($field_info as $field) { + if ($field['field_name'] == $field_name) { + break; + } + } // Start deltas from 0, and increment by one for each term attached to a // node.