You are here

public function Updater::install in Drupal 7

Installs a Drupal project, returns a list of next actions.

Parameters

FileTransfer $filetransfer: Object that is a child of FileTransfer.

array $overrides: An array of settings to override defaults; see self::getInstallArgs().

Return value

array An array of links which the user may need to complete the install.

File

includes/updater.inc, line 275
Classes used for updating various files in the Drupal webroot. These classes use a FileTransfer object to actually perform the operations. Normally, the FileTransfer is provided when the site owner is redirected to authorize.php as part of a multistep…

Class

Updater
Base class for Updaters used in Drupal.

Code

public function install(&$filetransfer, $overrides = array()) {
  try {

    // Establish arguments with possible overrides.
    $args = $this
      ->getInstallArgs($overrides);

    // Make sure the installation parent directory exists and is writable.
    $this
      ->prepareInstallDirectory($filetransfer, $args['install_dir']);

    // Copy the directory in place.
    $filetransfer
      ->copyDirectory($this->source, $args['install_dir']);

    // Make sure what we just installed is readable by the web server.
    $this
      ->makeWorldReadable($filetransfer, $args['install_dir'] . '/' . $this->name);

    // Potentially enable something?
    // @TODO: decide if we want to implement this.
    $this
      ->postInstall();

    // For now, just return a list of links of things to do.
    return $this
      ->postInstallTasks();
  } catch (FileTransferException $e) {
    throw new UpdaterFileTransferException(t('File Transfer failed, reason: !reason', array(
      '!reason' => strtr($e
        ->getMessage(), $e->arguments),
    )));
  }
}