Skip to content

Commit 779c646

Browse files
committed
fix(module:upgrade): fixed upgrading a single module #11
Old selected module's directory was not renamed and the upgrade was failing.
1 parent a7dc4fa commit 779c646

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Helpers/PwModuleTools.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,14 @@ public function extractModule() {
256256
$this->tools->nl();
257257
$this->tools->writeComment(" Extracting module...\n");
258258
$dir = \ProcessWire\wire('config')->paths->siteModules . $this->module;
259-
if (is_dir($dir)) chmod($dir, 0755);
259+
260+
if (is_dir($dir)) {
261+
$this->tools->writeComment(" Directory `$this->module` already exists, remaming to '.{$this->module}'");
262+
chmod($dir, 0755);
263+
$fs = new Filesystem();
264+
// rename module directory with a dot on front
265+
$fs->rename($dir, \ProcessWire\wire('config')->paths->siteModules.'.'.$this->module);
266+
}
260267

261268
$this->downloader->extract($this->compressedFilePath, \ProcessWire\wire('config')->paths->siteModules . $this->module, $this->module);
262269

@@ -282,4 +289,4 @@ public function downloadModule($url) {
282289
return $this;
283290
}
284291

285-
}
292+
}

0 commit comments

Comments
 (0)