diff -u includes/updater.inc includes/updater.inc --- includes/updater.inc +++ includes/updater.inc @@ -38,7 +38,7 @@ /** * @return string an absolute path to the default install location. */ - public static function getInstallDirectory(); + public function getInstallDirectory(); /** * Determine if the Updater can handle the project provided in $directory. diff -u modules/system/system.updater.inc modules/system/system.updater.inc --- modules/system/system.updater.inc +++ modules/system/system.updater.inc @@ -12,7 +12,16 @@ */ class ModuleUpdater extends Updater implements DrupalUpdaterInterface { - public static function getInstallDirectory() { + public function getInstallDirectory() { + // If the module is installed in the configuration path (conf_path()) + // we should install it there. If it is located elsewhere, such as + // sites/all/modules we should install it in the conf_path/modules directory. + if ($this->isInstalled()) { + $installed_path = drupal_get_path('module', $this->name); + if (substr($installed_path, 0, strlen(conf_path())) === conf_path()) { + return dirname(DRUPAL_ROOT . '/' . $installed_path); + } + } return DRUPAL_ROOT . '/' . conf_path() . '/modules'; } @@ -76,7 +85,16 @@ */ class ThemeUpdater extends Updater implements DrupalUpdaterInterface { - public static function getInstallDirectory() { + public function getInstallDirectory() { + // If the theme is installed in the configuration path (conf_path()) + // we should install it there. If it is located elsewhere, such as + // sites/all/themes we should install it in the conf_path/themes directory. + if ($this->isInstalled()) { + $installed_path = drupal_get_path('theme', $this->name); + if (substr($installed_path, 0, strlen(conf_path())) === conf_path()) { + return dirname(DRUPAL_ROOT . '/' . $installed_path); + } + } return DRUPAL_ROOT . '/' . conf_path() . '/themes'; }