You are here

function spaces_requirements in Spaces 5

Implementation of hook_requirements

File

./spaces.module, line 1203

Code

function spaces_requirements($phase) {
  $requirements = array();
  $t = get_t();
  switch ($phase) {
    case 'runtime':

      // Check OG settings.
      include dirname(__FILE__) . '/spaces_conf.inc';
      foreach ($conf as $key => $value) {
        if (variable_get($key, NULL) !== $value) {
          $requirements['spaces'] = array(
            'title' => $t('Spaces Configuration'),
            'description' => $t('The Spaces module requires a specific OG configureation describe in spaces_conf.inc. Please check that settings.php to verify that a line line %include exists', array(
              '%include' => "require(dirname(__FILE__) .'/../all/modules/spaces/spaces_conf.inc');",
            )),
            'severity' => REQUIREMENT_ERROR,
            'value' => $t('OG Misconfiguration'),
          );
        }
      }

      // Check that existing node types are og enabled
      $types = spaces_content_types();
      $existing_types = node_get_types();
      foreach ($types as $type => $feature) {
        if (og_is_omitted_type($type) && array_key_exists($type, $existing_types)) {
          $requirements['spaces'] = array(
            'title' => $t('Spaces Configuration'),
            'description' => $t('The !type content type appear to be misconfigured.', array(
              '!type' => l($type, 'admin/content/types/' . $type),
            )),
            'severity' => REQUIREMENT_ERROR,
            'value' => $t('OG Misconfiguration'),
          );
          return $requirements;
        }
      }
      $requirements['spaces'] = array(
        'title' => $t('Spaces Configuration'),
        'description' => t('The spaces module is installed and configured properly'),
        'severity' => REQUIREMENT_OK,
        'value' => $t('Installed correctly'),
      );
  }
  return $requirements;
}