Révision a192dc0b
Ajouté par Assos Assos il y a environ 8 ans
drupal7/sites/all/modules/feeds/feeds.install | ||
---|---|---|
60 | 60 |
function feeds_uninstall() { |
61 | 61 |
variable_del('http_request_timeout'); |
62 | 62 |
variable_del('feeds_reschedule'); |
63 |
variable_del('feeds_use_mbstring'); |
|
63 | 64 |
} |
64 | 65 |
|
65 | 66 |
/** |
... | ... | |
689 | 690 |
DrupalQueue::get('feeds_importer_expire')->deleteQueue(); |
690 | 691 |
} |
691 | 692 |
|
692 |
/** |
|
693 |
* Fix importer mappings for file and image fields to use :uri convention.
|
|
694 |
*/ |
|
693 |
/**
|
|
694 |
* Does nothing. Update removed.
|
|
695 |
*/
|
|
695 | 696 |
function feeds_update_7211(&$sandbox) { |
696 |
// If this is the first pass through this update function then set some |
|
697 |
// variables. |
|
698 |
if (!isset($sandbox['progress'])) { |
|
699 |
$importers = feeds_importer_load_all(TRUE); |
|
700 |
$sandbox['importers'] = array_keys($importers); |
|
701 |
$sandbox['progress'] = 0; |
|
702 |
$sandbox['updated_count'] = 0; |
|
703 |
$sandbox['max'] = count($sandbox['importers']); |
|
704 |
} |
|
705 |
|
|
706 |
if (empty($sandbox['importers'])) { |
|
707 |
return t('No importers to process.'); |
|
708 |
} |
|
709 |
|
|
710 |
// Load a single importer. |
|
711 |
$importer = array_pop($sandbox['importers']); |
|
712 |
$importer = feeds_importer($importer); |
|
713 |
$mappings = $importer->processor->getMappings(); |
|
714 |
|
|
715 |
foreach ($mappings as $key => $mapping) { |
|
716 |
// Act on mappings that do not contain a colon. |
|
717 |
if (strpos($mapping['target'], ':') !== FALSE) { |
|
718 |
continue; |
|
719 |
} |
|
720 |
|
|
721 |
// Get field data. Check if $info is empty to weed out non-field mappings |
|
722 |
// like temporary targets. |
|
723 |
if (!$info = field_info_field($mapping['target'])) { |
|
724 |
continue; |
|
725 |
} |
|
726 |
|
|
727 |
// Act on file or image fields. |
|
728 |
if (in_array($info['type'], array('file', 'image'))) { |
|
729 |
// Add ':uri' to fix the mapping. |
|
730 |
$mappings[$key]['target'] = $mapping['target'] . ':uri'; |
|
731 |
} |
|
732 |
} |
|
733 |
|
|
734 |
// If importer has changed, add the updated config and save it. |
|
735 |
if ($importer->processor->getMappings() !== $mappings) { |
|
736 |
$importer->processor->addConfig(array('mappings' => $mappings)); |
|
737 |
$importer->save(); |
|
738 |
$sandbox['updated_count']++; |
|
739 |
} |
|
740 |
|
|
741 |
$sandbox['progress']++; |
|
742 |
|
|
743 |
// Set the value for finished. If progress == max then finished will be 1, |
|
744 |
// signifying we are done. |
|
745 |
$sandbox['#finished'] = ($sandbox['progress'] / $sandbox['max']); |
|
746 |
|
|
747 |
if (empty($sandbox['importers'])) { |
|
748 |
$sandbox['#finished'] = 1; |
|
749 |
return t('@importers total importers processed, @updated_count with fields that were updated.', array('@importers' => $sandbox['max'], '@updated_count' => $sandbox['updated_count'])); |
|
750 |
} |
|
751 | 697 |
} |
752 | 698 |
|
753 | 699 |
/** |
Formats disponibles : Unified diff
Weekly update of contrib modules