mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 23:23:52 +08:00
commit
6e0715e822
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user