comparison core/modules/aggregator/aggregator.install @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 7a779792577d
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
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 }