You are here

function apps_install_verify in Apps 7

Show instructions and check system services to help guide direction for Apps installs.

2 string references to 'apps_install_verify'
apps_menu in ./apps.module
Implements hook_menu().
apps_profile_install_tasks in ./apps.profile.inc
Add install tasks to profile install tasks.

File

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

Code

function apps_install_verify() {
  drupal_set_title(t('Verify Apps support'));
  $form = array();
  $form['opening'] = array(
    '#markup' => '<h1>' . t('Verify Apps support') . '</h1>',
  );
  $form['openingtext'] = array(
    '#markup' => '<p>' . t('Installation of Apps requires that modules are installed on your site using the same mechanism as the Update module in Drupal core. This functionality depends on certain PHP extensions being enabled on your server. Below is the documentation & verification for the various methods of installing. <strong>Note that you need only <em>one</em> of these methods enabled in order to install apps.</strong>') . '</p>',
    '#weight' => -10,
  );

  // Verify FTP support
  $ftp_installed = extension_loaded('ftp');
  $form['ftp'] = array(
    '#type' => 'fieldset',
    '#title' => t('FTP (!status)', array(
      '!status' => $ftp_installed ? t('Enabled!') : t('Not enabled'),
    )),
    '#description' => '',
    '#collapsible' => !$ftp_installed,
    '#collapsed' => !$ftp_installed,
    '#weight' => $ftp_installed ? 0 : 10,
  );
  if (!$ftp_installed) {
    $form['ftp']['#description'] .= t('Your server does not have the FTP PHP extension. You will need to install it or use an alternative method. See <a href="http://us2.php.net/manual/en/book.ftp.php">http://us2.php.net/manual/en/book.ftp.php</a> for how to install the FTP PHP extension.') . '<br /><br />';
  }
  $form['ftp']['#description'] .= t('To install with FTP, you will need an FTP username and password that has permissions to write to your site directory on your server. Be aware that FTP is not an encrypted protocol and your credentials will be transmitted in the clear.');

  // Verify SSH support
  $ssh_installed = extension_loaded('ssh2');
  $form['ssh'] = array(
    '#type' => 'fieldset',
    '#title' => t('SSH (!status)', array(
      '!status' => $ssh_installed ? t('Enabled!') : t('Not enabled'),
    )),
    '#description' => '',
    '#collapsible' => !$ssh_installed,
    '#collapsed' => !$ssh_installed,
    '#weight' => $ssh_installed ? 1 : 11,
  );
  if (!$ssh_installed) {
    $form['ssh']['#description'] .= t('Your server does not have ssh2 installed. You will need to install it or use an alternative method. See <a href="http://us2.php.net/manual/en/book.ssh2.php">http://us2.php.net/manual/en/book.ssh2.php</a> for how to install the ssh2 php extension.') . '<br /><br />';
  }
  $form['ssh']['#description'] .= t('To install with SSH, you will need a username and password of a user that can SSH into the server and has write permissions to your site directory on your server.');

  // Verify web server write permissions
  $install_permissions = apps_installer_has_write_access();
  $vars = array(
    '@install_path' => variable_get('apps_install_path', APPS_INSTALL_PATH),
    '@lib_path' => apps_installer_lib_dir(),
  );
  $form['webserver'] = array(
    '#type' => 'fieldset',
    '#title' => t('Webserver direct install (!status)', array(
      '!status' => $install_permissions ? t('Enabled!') : t('Not enabled'),
    )),
    '#description' => '',
    '#collapsible' => !$install_permissions,
    '#collapsed' => !$install_permissions,
    '#weight' => $install_permissions ? 2 : 12,
  );
  $form['webserver']['#description'] .= $install_permissions ? t('You have write permissions to @install_path and @lib_path', $vars) . '<br /><br />' : t('You do not have sufficient permissions to install by webserver direct install. In order to assign these permissions, go to the root of your drupal install and type <br/><br/><strong>sudo chmod 777 @install_path</strong><br/><strong>sudo chmod 777 @lib_path</strong>', $vars) . '<br /><br />';
  $form['webserver']['#description'] .= t('Be aware that there are security issues with leaving your site in this state.');

  // When altering this form and adding an install option, set this value to
  // TRUE if your option is enabled (available).
  $app_enabled = $ftp_installed || $ssh_installed || $install_permissions;
  $form['app_enabled'] = array(
    '#type' => 'value',
    '#value' => $app_enabled,
  );
  $form['#process'] = array(
    'apps_install_verify_process',
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['continue'] = array(
    '#type' => 'submit',
    '#value' => t('Continue'),
    '#weight' => 20,
  );
  return $form;
}