getPlugin() public method

주어진 pluginId에 해당하는 플러그인을 조회하여 반환한다. PluginEntity 형태로 반환한다.
public getPlugin ( string $pluginId ) : PluginEntity
$pluginId string 조회할 plugin의 id
return PluginEntity
Exemplo n.º 1
0
 public function show($pluginId, PluginHandler $handler, PluginProvider $provider)
 {
     // refresh plugin cache
     $handler->getAllPlugins(true);
     $componentTypes = $this->getComponentTypes();
     $plugin = $handler->getPlugin($pluginId);
     $provider->sync($plugin);
     return XePresenter::make('show', compact('plugin', 'componentTypes'));
 }
 public function show($pluginId, PluginHandler $handler)
 {
     $componentTypes = $this->getComponentTypes();
     $plugin = $handler->getPlugin($pluginId);
     return Presenter::make('show', compact('plugin', 'componentTypes'));
 }
 public function putDownloadPlugin($pluginId, PluginHandler $handler, PluginProvider $provider, ComposerFileWriter $writer, InterceptionHandler $interceptionHandler, SessionManager $session)
 {
     $handler->getAllPlugins(true);
     $plugin = $handler->getPlugin($pluginId);
     if ($plugin === null) {
         throw new HttpException(422, 'Plugin not found.');
     }
     // 자료실에서 플러그인 정보 조회
     $pluginData = $provider->find($pluginId);
     if ($pluginData === null) {
         throw new HttpException(422, "Can not find the plugin(" . $pluginId . ") that should be installed from the Market-place.");
     }
     $title = $pluginData->title;
     $name = $pluginData->name;
     $version = $pluginData->latest_release->version;
     $operation = $handler->getOperation($writer);
     if ($operation['status'] === ComposerFileWriter::STATUS_RUNNING) {
         throw new HttpException(422, "이미 진행중인 요청이 있습니다.");
     }
     $timeLimit = config('xe.plugin.operation.time_limit');
     $writer->reset()->cleanOperation();
     $writer->update($name, $version, Carbon::now()->addSeconds($timeLimit)->toDateTimeString())->write();
     $this->reserveOperation($writer, $timeLimit, function ($code) use($plugin) {
         if ($code === 0 && $plugin->checkUpdated()) {
             $plugin->update();
         }
     });
     return redirect()->route('settings.plugins')->with('alert', ['type' => 'success', 'message' => '플러그인의 새로운 버전을 다운로드하는 중입니다.']);
 }