You are here

function apps_profile_check_dependencies in Apps 7

Function to check and make sure all dependencies are available. This will stop stray apps or broken downloads from stopping the install process for everything.

Copied from module_enable() in module.inc

1 call to apps_profile_check_dependencies()
apps_profile_enable_app_modules in ./apps.profile.inc
Install downloaded apps.

File

./apps.profile.inc, line 506
The install functions for the Apps module.

Code

function apps_profile_check_dependencies($module_list) {

  // Get all module data so we can find dependencies and sort.
  $module_data = system_rebuild_module_data();

  // Create an associative array with weights as values.
  $module_list = array_flip(array_values($module_list));
  while (list($module) = each($module_list)) {
    if (!isset($module_data[$module])) {

      // This module is not found in the filesystem, abort.
      return FALSE;
    }
    if ($module_data[$module]->status) {

      // Skip already enabled modules.
      unset($module_list[$module]);
      continue;
    }
    $module_list[$module] = $module_data[$module]->sort;

    // Add dependencies to the list, with a placeholder weight.
    // The new modules will be processed as the while loop continues.
    foreach (array_keys($module_data[$module]->requires) as $dependency) {
      if (!isset($module_list[$dependency])) {
        $module_list[$dependency] = 0;
      }
    }
  }

  // If we make it this far then everything is good.
  return TRUE;
}