You are here

function features_get_info in Features 6

Same name and namespace in other branches
  1. 7.2 features.module \features_get_info()
  2. 7 features.module \features_get_info()

Helper for retrieving info from system table.

6 calls to features_get_info()
features_admin_form in ./features.admin.inc
admin/build/features page callback.
features_export_form_validate_field in ./features.admin.inc
Validation for project field.
features_get_features in ./features.module
Wrapper around features_get_info() that returns an array of module info objects that are features.
features_get_modules in ./features.module
Return a module 'object' including .info information.
template_preprocess_features_admin_components in theme/theme.inc
Display feature component info

... See full list

File

./features.module, line 474
Module file for the features module, which enables the capture and management of features in Drupal. A feature is a collection of Drupal entities which taken together statisfy a certain use-case.

Code

function features_get_info($type = 'module', $name = NULL, $reset = FALSE) {
  static $cache;
  if (!isset($cache)) {
    $cache = cache_get('features_module_info');
  }
  if (empty($cache) || $reset) {
    $data = array();
    $ignored = variable_get('features_ignored_orphans', array());
    $result = db_query("SELECT filename, name, type, status, throttle, schema_version FROM {system} WHERE type = 'module' ORDER BY name ASC");
    while ($row = db_fetch_object($result)) {

      // If module is no longer enabled, remove it from the ignored orphans list.
      if (in_array($row->name, $ignored, TRUE) && !$row->status) {
        $key = array_search($row->name, $ignored, TRUE);
        unset($ignored[$key]);
      }

      // Parse and allow modules to alter the info file if necessary.
      $row->info = drupal_parse_info_file(dirname($row->filename) . '/' . $row->name . '.info');
      if (!empty($row->info)) {
        drupal_alter('system_info', $row->info, $row);
        if (!empty($row->info['features'])) {
          $data['feature'][$row->name] = $row;
        }
        $data['module'][$row->name] = $row;
      }
    }
    variable_set('features_ignored_orphans', $ignored);
    cache_set("features_module_info", $data);
    $cache = new stdClass();
    $cache->data = $data;
  }
  if (!empty($name)) {
    return !empty($cache->data[$type][$name]) ? $cache->data[$type][$name] : FALSE;
  }
  return !empty($cache->data[$type]) ? $cache->data[$type] : array();
}