8722892093b5f35460c97f499c848acefe8d8c17
[yaffs-website] / web / core / modules / aggregator / aggregator.install
1 <?php
2
3 /**
4  * @file
5  * Install, update and uninstall functions for the aggregator module.
6  */
7
8 /**
9  * Implements hook_requirements().
10  */
11 function aggregator_requirements($phase) {
12   $has_curl = function_exists('curl_init');
13   $requirements = [];
14   $requirements['curl'] = [
15     'title' => t('cURL'),
16     'value' => $has_curl ? t('Enabled') : t('Not found'),
17   ];
18   if (!$has_curl) {
19     $requirements['curl']['severity'] = REQUIREMENT_ERROR;
20     $requirements['curl']['description'] = t('The Aggregator module requires the <a href="https://secure.php.net/manual/en/curl.setup.php">PHP cURL library</a>. For more information, see the <a href="https://www.drupal.org/requirements/php/curl">online information on installing the PHP cURL extension</a>.');
21   }
22   return $requirements;
23 }
24
25 /**
26  * The simple presence of this update function clears cached field definitions.
27  */
28 function aggregator_update_8001() {
29   // Feed ID base field is now required.
30 }
31
32 /**
33  * Make the 'Source feed' field for aggregator items required.
34  */
35 function aggregator_update_8200() {
36   // aggregator_update_8001() did not update the last installed field storage
37   // definition for the aggregator item's 'Source feed' field.
38   $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
39   $field_definition = $definition_update_manager->getFieldStorageDefinition('fid', 'aggregator_item');
40   $field_definition->setRequired(TRUE);
41   $definition_update_manager->updateFieldStorageDefinition($field_definition);
42 }
43
44 /**
45  * Add a default value for the 'Refresh' field for aggregator feed entities.
46  */
47 function aggregator_update_8501() {
48   $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
49   $field_definition = $definition_update_manager->getFieldStorageDefinition('refresh', 'aggregator_feed');
50   $field_definition->setDefaultValue(3600);
51   $definition_update_manager->updateFieldStorageDefinition($field_definition);
52 }