aggregator.install 1.66 KB
Newer Older
1 2
<?php

3 4 5 6 7
/**
 * @file
 * Install, update and uninstall functions for the aggregator module.
 */

8 9 10 11 12 13 14
/**
 * Implements hook_requirements().
 */
function aggregator_requirements($phase) {
  $has_curl = function_exists('curl_init');
  $requirements = array();
  $requirements['curl'] = array(
15 16
    'title' => t('cURL'),
    'value' => $has_curl ? t('Enabled') : t('Not found'),
17 18 19
  );
  if (!$has_curl) {
    $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 23
  }
  return $requirements;
}
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

/**
 * @addtogroup updates-8.0.0-rc
 * @{
 */

/**
 * The simple presence of this update function clears cached field definitions.
 */
function aggregator_update_8001() {
  // Feed ID base field is now required.
}

/**
 * @} End of "addtogroup updates-8.0.0-rc".
 */
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60

/**
 * @addtogroup updates-8.2.x
 * @{
 */

/**
 * Make the 'Source feed' field for aggregator items required.
 */
function aggregator_update_8200() {
  // aggregator_update_8001() did not update the last installed field storage
  // definition for the aggregator item's 'Source feed' field.
  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  $field_definition = $definition_update_manager->getFieldStorageDefinition('fid', 'aggregator_item');
  $field_definition->setRequired(TRUE);
  $definition_update_manager->updateFieldStorageDefinition($field_definition);
}

/**
 * @} End of "addtogroup updates-8.2.x".
 */