module_install.updater.inc 886 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * @file
  4. * Subclasses of the ModuleUpdater class to update modules.
  5. */
  6. module_load_include('inc', 'module_install', 'module_install.api');
  7. module_load_include('inc', 'system', 'system.updater');
  8. /**
  9. * Extends the default ModuleUpdater to change the destination install path.
  10. */
  11. class ModuleInstallUpdater extends ModuleUpdater {
  12. /**
  13. * Returns the install directory.
  14. *
  15. * @return string
  16. * The path to the install directory.
  17. */
  18. public function getInstallDirectory() {
  19. if ($relative_path = drupal_get_path('module', $this->name)) {
  20. $relative_path = dirname($relative_path);
  21. }
  22. else {
  23. $relative_path = module_install_get_destination_choice('modules');
  24. }
  25. return DRUPAL_ROOT . '/' . $relative_path;
  26. }
  27. public function postInstall() {
  28. module_install_del_destination_choice();
  29. return parent::postInstall();
  30. }
  31. }