You are here

function hosting_get_features in Hostmaster (Aegir) 6

Get a listing of all known Hosting features.

Parameters

$refresh: (optional) Pass in TRUE to force the list of features to be rebuilt and not returned from the cache.

Return value

An array of Hosting features.

See also

hook_hosting_feature()

4 calls to hosting_get_features()
hosting_feature in modules/hosting/hosting.features.inc
Determine whether a specific feature of the hosting system is turned on.
hosting_features_form in modules/hosting/hosting.features.inc
The Hosting features form.
hosting_features_form_submit in modules/hosting/hosting.features.inc
Submit callback for the Hosting features form.
hosting_feature_node_types in modules/hosting/hosting.features.inc
Determine which node types are provided by Hosting features.

File

modules/hosting/hosting.features.inc, line 190
Include for functionality related to Hosting module features.

Code

function hosting_get_features($refresh = FALSE) {
  $cache = cache_get('hosting_features');
  if (empty($cache->data) || $refresh) {

    ## include any optional hosting.feature.*.inc files
    $files = drupal_system_listing("hosting\\.feature\\.[a-zA-Z_]*\\.inc\$", "modules");
    if (sizeof($files)) {
      foreach ($files as $name => $info) {
        include_once $info->filename;
      }
    }
    $functions = get_defined_functions();
    foreach ($functions['user'] as $function) {
      if (preg_match('/_hosting_feature$/', $function)) {
        $hooks[] = $function;
      }
    }
    $features = array();
    foreach ($hooks as $func) {
      $features = array_merge($features, $func());
    }
    cache_set('hosting_features', $features);
    return $features;
  }
  else {
    return $cache->data;
  }
}