From 5179d2eb5299fffc1e05dc352111246c7288b19d Mon Sep 17 00:00:00 2001 From: Daniel Klabbers Date: Sat, 13 Feb 2016 20:32:46 +0100 Subject: [PATCH 1/2] fixes #799, now properly assigning a id --- framework/core/src/Extension/Extension.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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); } /** From ef83a4681bb75faaea49b3530792c310da1fc113 Mon Sep 17 00:00:00 2001 From: Daniel Klabbers Date: Sat, 13 Feb 2016 20:33:33 +0100 Subject: [PATCH 2/2] fixes #800, forgot these controllers --- .../src/Api/Controller/UninstallExtensionController.php | 6 ++++-- .../core/src/Api/Controller/UpdateExtensionController.php | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) 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); } } }