UpdaterInterface.php 1.71 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
<?php

namespace Drupal\Core\Updater;

/**
 * Defines an interface for a class which can update a Drupal project.
 *
 * An Updater currently serves the following purposes:
 *   - It can take a given directory, and determine if it can operate on it.
 *   - It can move the contents of that directory into the appropriate place
 *     on the system using FileTransfer classes.
 *   - It can return a list of "next steps" after an update or install.
 *   - In the future, it will most likely perform some of those steps as well.
 */
interface UpdaterInterface {

  /**
   * Checks if the project is installed.
   *
   * @return bool
   */
  public function isInstalled();

  /**
   * Returns the system name of the project.
   *
   * @param string $directory
28
   *   A directory containing a project.
29 30 31 32
   */
  public static function getProjectName($directory);

  /**
33
   * Returns the path to the default install location for the current project.
34 35 36 37 38 39
   *
   * @return string
   *   An absolute path to the default install location.
   */
  public function getInstallDirectory();

40 41 42 43 44 45 46 47
  /**
   * Returns the name of the root directory under which projects will be copied.
   *
   * @return string
   *   A relative path to the root directory.
   */
  public static function getRootDirectoryRelativePath();

48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
  /**
   * Determines if the Updater can handle the project provided in $directory.
   *
   * @param string $directory
   *
   * @return bool
   *   TRUE if the project is installed, FALSE if not.
   */
  public static function canUpdateDirectory($directory);

  /**
   * Actions to run after an install has occurred.
   */
  public function postInstall();

  /**
   * Actions to run after an update has occurred.
   */
  public function postUpdate();
}