Révision 41cc1b08
Ajouté par Assos Assos il y a presque 9 ans
drupal7/sites/all/modules/feeds/feeds.install | ||
---|---|---|
11 | 11 |
function feeds_requirements($phase) { |
12 | 12 |
$t = get_t(); |
13 | 13 |
|
14 |
$requirements = array( |
|
15 |
'simplexml' => array( |
|
16 |
'title' => $t('SimpleXML'), |
|
17 |
'value' => extension_loaded('SimpleXML') ? $t('Enabled') : $t('Disabled'), |
|
18 |
'description' => $t('SimpleXML PHP module is required for Feeds Syndication Parser.'), |
|
19 |
'severity' => REQUIREMENT_INFO, |
|
20 |
), |
|
21 |
'simplepie' => array( |
|
22 |
'title' => $t('SimplePie'), |
|
23 |
'value' => $t('Unknown at install time.'), |
|
24 |
'description' => $t('SimplePie library is required for Feeds SimplePie Parser.'), |
|
25 |
'severity' => REQUIREMENT_INFO, |
|
26 |
) |
|
27 |
); |
|
28 |
if ($phase == 'runtime') { |
|
29 |
// Check for SimpleXML, required by FeedsSyndicationParser. |
|
30 |
if (extension_loaded('SimpleXML')) { |
|
31 |
$requirements['simplexml']['severity'] = REQUIREMENT_OK; |
|
32 |
} |
|
33 |
else { |
|
34 |
$requirements['simplexml']['severity'] = REQUIREMENT_WARNING; |
|
35 |
$requirements['simplexml']['description'] .= ' ' . t('It has been disabled at compile time, seek instructions from the server mantainers to enable it.'); |
|
36 |
} |
|
37 |
// Check for SimplePie, required by FeedsSimplePieParser. |
|
38 |
if (feeds_simplepie_exists()) { |
|
39 |
$requirements['simplepie']['value'] = t('Enabled'); |
|
40 |
$requirements['simplepie']['severity'] = REQUIREMENT_OK; |
|
14 |
$requirements = array(); |
|
15 |
|
|
16 |
module_load_include('module', 'feeds'); |
|
17 |
// Check if we have any SimplePie importers. |
|
18 |
$needs_simplepie = FALSE; |
|
19 |
foreach (feeds_importer_load_all() as $importer) { |
|
20 |
if ($importer->config['parser']['plugin_key'] === 'FeedsSimplePieParser') { |
|
21 |
$needs_simplepie = TRUE; |
|
22 |
break; |
|
41 | 23 |
} |
42 |
else { |
|
43 |
$requirements['simplepie']['value'] = t('Not installed'); |
|
44 |
$requirements['simplepie']['severity'] = REQUIREMENT_WARNING; |
|
45 |
$requirements['simplepie']['description'] .= ' ' . t( |
|
46 |
'Download the compiled version of the library from <a href="@simplepie-download-url">SimplePie download page</a>.', |
|
47 |
array('@simplepie-download-url' => 'http://simplepie.org/downloads/') |
|
48 |
); |
|
24 |
} |
|
25 |
|
|
26 |
if (!$needs_simplepie) { |
|
27 |
return $requirements; |
|
28 |
} |
|
29 |
|
|
30 |
$requirements['simplepie'] = array( |
|
31 |
'title' => $t('SimplePie'), |
|
32 |
'value' => $t('Installed'), |
|
33 |
'description' => $t('The SimplePie library is required for Feeds SimplePie Parser.'), |
|
34 |
'severity' => REQUIREMENT_OK, |
|
35 |
); |
|
36 |
|
|
37 |
if (!feeds_simplepie_exists()) { |
|
38 |
$requirements['simplepie']['value'] = $t('Not installed'); |
|
39 |
|
|
40 |
$folder = drupal_get_path('module', 'feeds') . '/libraries'; |
|
41 |
if (module_exists('libraries')) { |
|
42 |
$folder = 'sites/all/libraries/simplepie'; |
|
49 | 43 |
} |
44 |
|
|
45 |
$args = array( |
|
46 |
'!url' => 'http://simplepie.org/downloads/', |
|
47 |
'%folder' => $folder, |
|
48 |
'%file' => 'simplepie.compiled.php', |
|
49 |
); |
|
50 |
$requirements['simplepie']['description'] .= $t('<br />Download the compiled, single-file version of the library from the <a href="!url">SimplePie download page</a>, place it into %folder and rename it to %file.', $args); |
|
51 |
$requirements['simplepie']['severity'] = REQUIREMENT_ERROR; |
|
50 | 52 |
} |
53 |
|
|
51 | 54 |
return $requirements; |
52 | 55 |
} |
53 | 56 |
|
... | ... | |
56 | 59 |
*/ |
57 | 60 |
function feeds_uninstall() { |
58 | 61 |
variable_del('http_request_timeout'); |
62 |
variable_del('feeds_reschedule'); |
|
59 | 63 |
} |
60 | 64 |
|
61 | 65 |
/** |
... | ... | |
347 | 351 |
'type' => array('type'), |
348 | 352 |
), |
349 | 353 |
); |
354 |
|
|
355 |
$schema['cache_feeds_http'] = drupal_get_schema_unprocessed('system', 'cache'); |
|
356 |
$schema['cache_feeds_http']['description'] = 'Cache table for Feeds downloads.'; |
|
357 |
|
|
350 | 358 |
return $schema; |
351 | 359 |
} |
352 | 360 |
|
... | ... | |
665 | 673 |
$sandbox['#finished'] = 1; |
666 | 674 |
} |
667 | 675 |
} |
676 |
|
|
677 |
/** |
|
678 |
* Reschedules feeds jobs. |
|
679 |
*/ |
|
680 |
function feeds_update_7209() { |
|
681 |
// Reschedule all importers. |
|
682 |
variable_set('feeds_reschedule', TRUE); |
|
683 |
|
|
684 |
// Our expire callback has changed names, remove all existing callbacks. |
|
685 |
db_delete('job_schedule') |
|
686 |
->condition('name', 'feeds_importer_expire') |
|
687 |
->execute(); |
|
688 |
|
|
689 |
DrupalQueue::get('feeds_importer_expire')->deleteQueue(); |
|
690 |
} |
|
691 |
|
|
692 |
/** |
|
693 |
* Fix importer mappings for file and image fields to use :uri convention. |
|
694 |
*/ |
|
695 |
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 |
} |
|
752 |
|
|
753 |
/** |
|
754 |
* Create {cache_feeds_http} table. |
|
755 |
*/ |
|
756 |
function feeds_update_7212() { |
|
757 |
if (!db_table_exists('cache_feeds_http')) { |
|
758 |
$schema = drupal_get_schema_unprocessed('system', 'cache'); |
|
759 |
$schema['description'] = 'Cache table for Feeds downloads.'; |
|
760 |
db_create_table('cache_feeds_http', $schema); |
|
761 |
} |
|
762 |
} |
Formats disponibles : Unified diff
Update feeds 7.x-2.0-alpha9 -> 7.x-2.0-beta1
Install lib simplepie 1.3.1