UpdaterInterface.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace Drupal\Core\Updater;
  3. /**
  4. * Defines an interface for a class which can update a Drupal project.
  5. *
  6. * An Updater currently serves the following purposes:
  7. * - It can take a given directory, and determine if it can operate on it.
  8. * - It can move the contents of that directory into the appropriate place
  9. * on the system using FileTransfer classes.
  10. * - It can return a list of "next steps" after an update or install.
  11. * - In the future, it will most likely perform some of those steps as well.
  12. */
  13. interface UpdaterInterface {
  14. /**
  15. * Checks if the project is installed.
  16. *
  17. * @return bool
  18. */
  19. public function isInstalled();
  20. /**
  21. * Returns the system name of the project.
  22. *
  23. * @param string $directory
  24. * A directory containing a project.
  25. */
  26. public static function getProjectName($directory);
  27. /**
  28. * Returns the path to the default install location for the current project.
  29. *
  30. * @return string
  31. * An absolute path to the default install location.
  32. */
  33. public function getInstallDirectory();
  34. /**
  35. * Returns the name of the root directory under which projects will be copied.
  36. *
  37. * @return string
  38. * A relative path to the root directory.
  39. */
  40. public static function getRootDirectoryRelativePath();
  41. /**
  42. * Determines if the Updater can handle the project provided in $directory.
  43. *
  44. * @param string $directory
  45. *
  46. * @return bool
  47. * TRUE if the project is installed, FALSE if not.
  48. */
  49. public static function canUpdateDirectory($directory);
  50. /**
  51. * Actions to run after an install has occurred.
  52. */
  53. public function postInstall();
  54. /**
  55. * Actions to run after an update has occurred.
  56. */
  57. public function postUpdate();
  58. }