Merge pull request #801 from Luceos/extension_fix

Extension fix
This commit is contained in:
Daniël Klabbers 2016-02-14 22:18:08 +01:00
commit 48e29ed168
3 changed files with 18 additions and 5 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
/**