You are here

function features_update_6101 in Features 7

Same name and namespace in other branches
  1. 6 features.install \features_update_6101()
  2. 7.2 features.install \features_update_6101()

Update 6101: Set codestate signature for all features.

This update generates a codestate for all feature/component pairs which have been installed prior to this version of Features. This prevents automatic rebuilds from occurring against any rebuildable components that have been overridden.

File

./features.install, line 87
Install, update and uninstall functions for the features module.

Code

function features_update_6101() {

  // Ensure all of our own API functions still exist in in this version
  // of Features. It's possible that the "future me" will not have these
  // functions, so I should check.
  module_load_include('inc', 'features', "features.export");
  $functions = array(
    'features_include',
    'features_hook',
    'features_get_components',
    'features_get_features',
    'features_get_signature',
    'features_set_signature',
  );
  $doit = TRUE;
  foreach ($functions as $function) {
    $doit = $doit && function_exists($function);
  }
  if ($doit) {
    features_include();
    $features = array_keys(features_get_features(NULL, TRUE));
    $components = array_keys(features_get_components());
    foreach ($features as $feature) {
      if (module_exists($feature)) {
        foreach ($components as $component) {
          if (features_hook($component, 'features_rebuild') && features_get_signature('cache', $feature, $component) === FALSE) {
            features_set_signature($feature, $component, -1);
          }
        }
      }
    }
  }
  return array();
}