You are here

function apps_profile_enable_app_modules_finished in Apps 7

Batch callback invoked when enable batch is completed.

1 string reference to 'apps_profile_enable_app_modules_finished'
apps_profile_enable_app_modules in ./apps.profile.inc
Install downloaded apps.

File

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

Code

function apps_profile_enable_app_modules_finished($success, $results) {

  // Only display errors, on success do nothing since on success any
  // message we print will show up in a weird context (next page)
  if (!empty($results['errors'])) {
    $error_list = array(
      'title' => t('Enabling apps failed:'),
      'items' => $results['errors'],
    );

    // @ignore security_2
    drupal_set_message(theme('item_list', $error_list), 'error');
  }
  elseif (!$success) {

    // Ideally we're catching all Exceptions, so they should never see this,
    // but just in case, we have to tell them something.
    drupal_set_message(t('Fatal error trying to enable apps.'), 'error');
  }

  // Allow profiles to add default content.
  if (!empty($_SESSION['apps_default_content']) && isset($_SESSION['apps_server']['default content callback']) && !empty($results['enabled modules'])) {
    $function = $_SESSION['apps_server']['default content callback'];
    if (function_exists($function)) {
      $function($results['enabled modules']);
    }
  }

  // Do a little cleanup
  // We cannot unset $_SESSION['apps'] here because it is used in the
  // run check for this task and can cause weird interactions with
  // the batch operations.
  // unset($_SESSION['apps']);
  unset($_SESSION['apps_default_content']);
  unset($_SESSION['apps_server']);
  unset($_SESSION['apps_manifest']);
  unset($_SESSION['apps_downloads']);
}