diff --git a/modules/system/system.updater.inc b/modules/system/system.updater.inc index 0df1ad9..61d4a93 100644 --- a/modules/system/system.updater.inc +++ b/modules/system/system.updater.inc @@ -26,6 +26,14 @@ class ModuleUpdater extends Updater implements DrupalUpdaterInterface { public function getInstallDirectory() { if ($relative_path = drupal_get_path('module', $this->name)) { $relative_path = dirname($relative_path); + $project_name = $this->getProjectName($relative_path); + do { + // Some modules keep their .info file in a subdirectory of their root + // directory, e.g., sites/all/modules/MODULE/MODULE/MODULE.info. To find + // the appropriate directory to install the module in, we repeatedly + // ascend to the parent directory until the project name differs. + $relative_path = dirname($relative_path); + } while ($this->getProjectName($relative_path) == $project_name); } else { $relative_path = 'sites/all/modules'; @@ -107,6 +115,14 @@ class ThemeUpdater extends Updater implements DrupalUpdaterInterface { public function getInstallDirectory() { if ($relative_path = drupal_get_path('theme', $this->name)) { $relative_path = dirname($relative_path); + $project_name = $this->getProjectName($relative_path); + do { + // Some modules keep their .info file in a subdirectory of their root + // directory, e.g., sites/all/modules/MODULE/MODULE/MODULE.info. To find + // the appropriate directory to install the module in, we repeatedly + // ascend to the parent directory until the project name differs. + $relative_path = dirname($relative_path); + } while ($this->getProjectName($relative_path) == $project_name); } else { $relative_path = 'sites/all/themes';