Skip to content

Commit

Permalink
Added support for installing from arbitary paths
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxwilko committed Jan 3, 2025
1 parent a1b7c3a commit 312e6bd
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions modules/system/classes/extensions/source/ExtensionSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ public function createFiles(): ?static

break;
case static::SOURCE_LOCAL:
$extensionPath = $this->guessPathFromCode($this->code);
if ($this->path !== $extensionPath) {
File::moveDirectory($this->path, $extensionPath);
$this->path = $extensionPath;
}
break;
}

Expand Down Expand Up @@ -223,8 +228,8 @@ protected function checkStatus(): string
break;
case static::SOURCE_MARKET:
case static::SOURCE_LOCAL:
$path = $this->path ?? $this->guessPathFromCode($this->code);
if (!File::exists($path)) {
// Check the path the extension "should" be installed to
if (!File::exists($this->guessPathFromCode($this->code))) {
return static::STATUS_UNINSTALLED;
}
break;
Expand All @@ -247,6 +252,10 @@ protected function guessPathFromCode(string $code): ?string
};
}

/**
* @throws \ReflectionException
* @throws ApplicationException
*/
protected function guessCodeFromPath(string $path): ?string
{
return match ($this->type) {
Expand Down

0 comments on commit 312e6bd

Please sign in to comment.