You are here

function forum_access_requirements in Forum Access 7

Implements hook_requirements().

Remind the user to upgrade to Chain Menu Access API 2.x.

1 call to forum_access_requirements()
forum_access_menu_alter in ./forum_access.module
Implements hook_menu_alter().

File

./forum_access.module, line 17
forum_access.module

Code

function forum_access_requirements($phase) {
  require_once DRUPAL_ROOT . '/includes/install.inc';
  $result = array();
  switch ($phase) {
    case 'update':
    case 'runtime':
      $t = get_t();
      $path = drupal_get_filename('module', 'chain_menu_access');
      $path = substr($path, 0, strlen($path) - 7) . '.info';
      $info = drupal_parse_info_file($path);
      $version = isset($info['version']) ? $info['version'] : $t('Unknown');
      $found = preg_match('/7\\.x-([0-9]*)\\./', $version, $matches);
      if ($found && $matches[1] == 1 || !$found) {
        $cma = 'Chain Menu Access API';
        $variables = array(
          '@Chain_Menu_Access_API' => $cma,
          '@module' => url('admin/modules'),
        );
        $result[] = array(
          'title' => $t('@Chain_Menu_Access_API module', $variables),
          'value' => $version,
          'description' => $t('Version 1.x is obsolete. Upgrade to version 2.x as soon as <em>all</em> installed client modules support that version.') . '<br />' . $t('Check the <a href="@module">module administration page</a> to find out which of your modules depend on @Chain_Menu_Access_API.', $variables),
          'severity' => REQUIREMENT_WARNING,
        );
      }
  }
  return $result;
}