function apps_profile_enable_app_modules in Apps 7
Install downloaded apps.
1 string reference to 'apps_profile_enable_app_modules'
- apps_profile_install_tasks in ./
apps.profile.inc - Add install tasks to profile install tasks.
File
- ./
apps.profile.inc, line 390 - The install functions for the Apps module.
Code
function apps_profile_enable_app_modules(&$install_state) {
// If this is not an interactive install, we may have apps that were selected
// but not installed. Filter them out.
if (!$install_state['interactive']) {
apps_include('manifest');
// If not interactive it is one big request, clear some static caches
// so we recognized modules that have been downloaded just prior.
system_list_reset();
drupal_static_reset('apps_manifest');
$installed_apps = apps_apps($_SESSION['apps_server']['machine name'], array(
'installed' => TRUE,
), TRUE);
$_SESSION['apps'] = array_intersect_key($_SESSION['apps'], $installed_apps);
// If no selected apps are installed, we have nothing to enable.
if (empty($_SESSION['apps'])) {
return;
}
}
$modules = array_keys($_SESSION['apps']);
// Do dependency checking so everything doesn't break from one missing dependency.
foreach ($modules as $id => $module) {
if (!apps_profile_check_dependencies(array(
$module => $module,
))) {
// Something went wrong. Remove from queue and add error.
unset($modules[$id]);
$module_info = system_get_info('module', $module);
$module_name = isset($module_info['name']) ? $module_info['name'] : $module;
drupal_set_message(t('There was an error installing @module app.', array(
'@module' => $module_name,
)), 'error');
}
}
if (!empty($modules)) {
// Setup the batch comments
$enable_commands = array();
foreach ($modules as $module) {
$module_info = system_get_info('module', $module);
$module_name = isset($module_info['name']) ? $module_info['name'] : $module;
$enable_commands[] = array(
'app_profile_enable_module',
array(
$module,
$module_name,
),
);
}
// Setup the batch operation
$batch = array(
'operations' => $enable_commands,
'file' => drupal_get_path('module', 'apps') . '/apps.profile.inc',
'title' => t('Enabling apps'),
'init_message' => t('Preparing to enable the needed apps'),
'finished' => 'apps_profile_enable_app_modules_finished',
);
return $batch;
}
}