You are here

function og_migrate_build_dependencies in Organic groups 7

Find dependencies any level deep and fill in required by information too.

Parameters

$files: The array of filesystem objects used to rebuild the cache.

Return value

The same array with the new keys for each module:

  • requires: An array with the keys being the modules that this module requires.
  • required_by: An array with the keys being the modules that will not work without this module.
1 call to og_migrate_build_dependencies()
og_migrate_get_plugins_dependencies in og_migrate/og_migrate.module
Get a list of plugin names by dependencies.

File

og_migrate/og_migrate.module, line 141
Migrate and upgrade Organic groups data.

Code

function og_migrate_build_dependencies() {
  require_once DRUPAL_ROOT . '/includes/graph.inc';
  $plugins = og_migrate_get_plugins();
  foreach ($plugins as $plugin_name => $plugin) {
    $graph[$plugin_name]['edges'] = array();
    if (isset($plugin['dependencies']) && is_array($plugin['dependencies'])) {
      foreach ($plugin['dependencies'] as $dependency) {
        $graph[$plugin_name]['edges'][$dependency] = $dependency;
      }
    }
  }
  drupal_depth_first_search($graph);
  foreach ($graph as $plugin_name => $data) {
    $plugins[$plugin_name]['required_by'] = isset($data['reverse_paths']) ? $data['reverse_paths'] : array();
    $plugins[$plugin_name]['requires'] = isset($data['paths']) ? $data['paths'] : array();
    $plugins[$plugin_name]['sort'] = $data['weight'];
  }
  return $plugins;
}