Author: XE Developers (developers@xpressengine.com)
 /**
  * Execute the console command.
  *
  * @param ComposerFileWriter  $writer
  * @param InterceptionHandler $interceptionHandler
  *
  * @return bool|null
  */
 public function fire(ComposerFileWriter $writer, InterceptionHandler $interceptionHandler)
 {
     // php artisan xe:update [version] [--skip-download]
     // title
     // Xpressengine을 업데이트합니다.
     $this->output->block('Updating Xpressengine.');
     // check option
     if (!$this->option('skip-download')) {
         // 업데이트 파일의 다운로드는 아직 지원하지 않습니다. 아래의 안내대로 코어를 업데이트 하십시오.
         $this->output->caution('Downloading update files does not yet supported. Follow the guide below for update.');
         $this->printGuide();
         return null;
     }
     // version 안내
     $installedVersion = trim(file_get_contents(storage_path('app/installed')));
     //  업데이트 버전 정보:
     $this->warn(' Version information:');
     $this->output->text("  {$installedVersion} -> " . __XE_VERSION__);
     // confirm
     if ($this->confirm("The Xpressengine ver." . __XE_VERSION__ . " will be updated. It may take up to a few minutes. \r\nDo you want to update?") === false) {
         //return;
     }
     // 플러그인 업데이트 잠금
     $writer->reset()->write();
     // composer update실행(composer update --no-dev)
     if (!$this->option('skip-composer')) {
         $this->output->section('Composer update command is running.. It may take up to a few minutes.');
         $this->line(" composer update");
         try {
             $this->runComposer(base_path(), "update");
         } catch (\Exception $e) {
         }
     }
     // migration
     $this->output->section('Running migration..');
     $this->migrateCore($installedVersion, __XE_VERSION__);
     // clear proxy
     $interceptionHandler->clearProxies();
     // mark installed
     $this->markInstalled();
     $this->output->success("Update the Xpressengine to ver." . __XE_VERSION__ . ".");
 }
 public function testInterceptionTestAfter()
 {
     // recreate interceptor
     $interceptor = InterceptionHandler::singleton(null, true);
     $interceptor->addAdvisor(['Xpressengine\\Tests\\Interception\\Document@insertDocument', 'Xpressengine\\Tests\\Interception\\Document@checkInput'], ['ad2' => ['ad3']], function ($target, $title, $content) {
         if ($target->invokedMethod == 'insertDocument') {
             return 'ad2(' . $target($title, $content) . ')';
         }
         if ($target->invokedMethod == 'checkInput') {
             $title = 'modified ' . $title . ' by ad2';
             $content = 'modified ' . $content . ' by ad2';
             return [$title, $content];
         }
     });
     $interceptor->addAdvisor('Xpressengine\\Tests\\Interception\\Document@insertDocument', ['ad1' => ['after' => 'ad2']], function ($target, $title, $content) {
         return 'ad1(' . $target($title, $content) . ')';
     });
     $document = Document::newInstance();
     $t = 't';
     $c = 'c';
     $ret = $document->insertDocument($t, $c);
     $this->assertEquals('ad1(ad2(insertDocument("modified t by ad2", "modified c by ad2")))', $ret);
 }
 protected function setUp()
 {
     $this->interceptor = InterceptionHandler::singleton(null, true);
     $this->targetObject = Document::newInstance($this->interceptor);
 }
 /**
  * Factory constructor.
  *
  * @param InterceptionHandler $interception intercption handler
  */
 public function __construct(InterceptionHandler $interception)
 {
     $this->proxy = $interception->proxy(Counter::class, 'Counter');
 }
 public function putUpdatePlugin($pluginId, PluginHandler $handler, InterceptionHandler $interceptionHandler)
 {
     try {
         $handler->updatePlugin($pluginId);
         $interceptionHandler->clearProxies();
     } 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' => '플러그인을 업데이트했습니다.']);
 }