public function delete(Request $request, PluginHandler $handler, PluginProvider $provider, ComposerFileWriter $writer, $pluginId)
{
$handler->getAllPlugins(true);
$plugin = $handler->getPlugin($pluginId);
if ($plugin === null) {
throw new HttpException(422, 'Plugin not found.');
}
if ($plugin->isActivated()) {
throw new HttpException(422, 'Plugin is not deactivated. Please deactivate the plugin.');
}
if ($plugin->isDevelopMode()) {
$handler->uninstallPlugin($pluginId);
return redirect()->route('settings.plugins')->with('alert', ['type' => 'success', 'message' => '플러그인을 삭제하였습니다.']);
}
$operation = $handler->getOperation($writer);
if ($operation['status'] === ComposerFileWriter::STATUS_RUNNING) {
throw new HttpException(422, "이미 진행중인 요청이 있습니다.");
}
$handler->uninstallPlugin($pluginId);
$timeLimit = config('xe.plugin.operation.time_limit');
$writer->reset()->cleanOperation();
$writer->uninstall($plugin->getName(), Carbon::now()->addSeconds($timeLimit)->toDateTimeString())->write();
$this->reserveOperation($writer, $timeLimit);
return redirect()->route('settings.plugins')->with('alert', ['type' => 'success', 'message' => '플러그인을 삭제중입니다.']);
}