You are here

function apps_app_install in Apps 7

Callback for app install TODO: check to see the app is install able and then install TODO: should goto config page but pass on the current destination NOTE: it is expected that this page would be called with a drupal desination set

1 string reference to 'apps_app_install'
apps_menu in ./apps.module
Implements hook_menu().

File

./apps.pages.inc, line 284
The page callbacks for the Apps module.

Code

function apps_app_install($app) {
  $token_name = 'install-' . $app['machine_name'];
  if ($confirm_form = apps_display_confirm_form(t('Are you sure you want to install @name?', array(
    '@name' => $app['name'],
  )), $token_name)) {
    return $confirm_form;
  }
  apps_include('installer');
  require_once DRUPAL_ROOT . '/includes/authorize.inc';
  $action = arg(5);
  switch ($action) {
    case 'install':
      $_SESSION['apps_install_next'] = apps_app_page_path($app, 'enable');
      $install = apps_install_downloads();

      // Error encountered during install.
      if ($install === FALSE) {
        drupal_goto(apps_app_page_path($app));
      }
      else {
        return $install;
      }
    default:

      // Clear cache so downloads new files.
      apps_clear_update_disk_cache();

      // Adds an extra path element to avoid an endless loop. If we check for
      // install at arg(4) we are usually there. So here we add an install at
      // arg(5) and that will get caught in the case above ^-^
      $_SESSION['apps_install_next'] = apps_app_page_path($app, 'install/install');
      apps_download_apps($app);
      break;
  }
}