diff --git a/framework/core/src/Api/Controller/UninstallExtensionController.php b/framework/core/src/Api/Controller/UninstallExtensionController.php index f1cf8113a..cc44e974b 100644 --- a/framework/core/src/Api/Controller/UninstallExtensionController.php +++ b/framework/core/src/Api/Controller/UninstallExtensionController.php @@ -37,7 +37,9 @@ class UninstallExtensionController extends AbstractDeleteController $name = array_get($request->getQueryParams(), 'name'); - $this->extensions->disable($name); - $this->extensions->uninstall($name); + $extension = $this->extensions->getExtension($name); + + $this->extensions->disable($extension); + $this->extensions->uninstall($extension); } } diff --git a/framework/core/src/Api/Controller/UpdateExtensionController.php b/framework/core/src/Api/Controller/UpdateExtensionController.php index 716dc8108..a8ad2ba3a 100644 --- a/framework/core/src/Api/Controller/UpdateExtensionController.php +++ b/framework/core/src/Api/Controller/UpdateExtensionController.php @@ -42,10 +42,12 @@ class UpdateExtensionController implements ControllerInterface $enabled = array_get($request->getParsedBody(), 'enabled'); $name = array_get($request->getQueryParams(), 'name'); + $extension = $this->extensions->getExtension($name); + if ($enabled === true) { - $this->extensions->enable($name); + $this->extensions->enable($extension); } elseif ($enabled === false) { - $this->extensions->disable($name); + $this->extensions->disable($extension); } } } diff --git a/framework/core/src/Extension/Extension.php b/framework/core/src/Extension/Extension.php index 33ad9ff9b..22f9f2380 100644 --- a/framework/core/src/Extension/Extension.php +++ b/framework/core/src/Extension/Extension.php @@ -86,9 +86,18 @@ class Extension implements Arrayable */ public function __construct($path, $composerJson) { - $this->id = end(explode('/', $path)); $this->path = $path; $this->composerJson = $composerJson; + $this->assignId(); + } + + /** + * Assigns the id for the extension used globally. + */ + protected function assignId() + { + $segments = explode('/', $this->path); + $this->id = end($segments); } /**