Author: XE Developers (developers@xpressengine.com)
コード例 #1
0
 public function postUpdatePlugin($pluginId, PluginHandler $handler)
 {
     try {
         $handler->updatePlugin($pluginId);
     } catch (XpressengineException $e) {
         throw new HttpException(Response::HTTP_FORBIDDEN, $e->getMessage(), $e);
     } catch (\Exception $e) {
         throw $e;
     }
     app('session.store')->flash('alert', ['type' => 'success', 'message' => '플러그인을 업데이트했습니다.']);
     return XePresenter::makeApi(['type' => 'success', 'message' => '플러그인을 업데이트했습니다.']);
 }
コード例 #2
0
 /**
  * activatePlugin
  *
  * @param $pluginId
  *
  * @return void
  */
 protected function updatePlugin($pluginId)
 {
     $this->handler->getAllPlugins(true);
     $this->handler->updatePlugin($pluginId);
 }
コード例 #3
0
 public function show($pluginId, PluginHandler $handler)
 {
     $componentTypes = $this->getComponentTypes();
     $plugin = $handler->getPlugin($pluginId);
     return Presenter::make('show', compact('plugin', 'componentTypes'));
 }
コード例 #4
0
 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' => '플러그인의 새로운 버전을 다운로드하는 중입니다.']);
 }