You are here

function _calendar_systems_patches_requirements in Calendar Systems 6.2

Internal helper of hook_requirements() implementation.

Return value

An array requirements checking results as per required by hook_requirements() implementation.

1 call to _calendar_systems_patches_requirements()
calendar_systems_requirements in ./calendar_systems.install
Implements hook_requirements().

File

./calendar_systems.patch.inc, line 108
A collection of internal helpers around the compatibility patches.

Code

function _calendar_systems_patches_requirements() {
  $t = get_t();

  // Requirements array as per required by hook_requirements().
  $requirements = array(
    'calendar_systems' => array(
      'title' => $t('Calendar Systems'),
      'value' => $t('Not installed correctly.'),
    ),
  );

  // The message to be shown when the requirements are not met.
  $error = $t('Calendar Systems required patches are not applied yet. Please read the <a href="!link">installation instructions</a>.', array(
    '!link' => drupal_get_path('module', 'calendar_systems') . '/INSTALL.txt',
  ));

  // Check if the required patches are currently applied.
  if (_calendar_systems_patches_applied()) {
    $requirements['calendar_systems']['severity'] = REQUIREMENT_OK;
    $requirements['calendar_systems']['value'] = $t('Installed correctly.');
    return $requirements;
  }

  // Allow user to enable the module if there are a 'patch manager' module available,
  // even if the requirements are not met yet.
  if ($phase == 'install' && (module_exists('patchdoq') || module_exists('patch_manager'))) {
    $severity = REQUIREMENT_WARNING;
  }
  else {
    $severity = REQUIREMENT_ERROR;
  }
  $requirements['calendar_systems'] += array(
    'severity' => $severity,
    'description' => $error,
  );
  return $requirements;
}