Xpressengine\Plugin\Composer\ComposerFileWriter::reset PHP Méthode

reset() public méthode

현재 설치된 플러그인들의 정보를 조회하여 반영한다.
public reset ( )
    public function reset()
    {
        // initialize
        $requires = [];
        $replace = [];
        array_set($this->data, 'repositories', [['type' => 'composer', 'url' => $this->packagistUrl]]);
        $dir = $this->scanner->getPluginDirectory();
        $operation = '>=';
        foreach ($this->scanner->scanDirectory() as $plugin) {
            $name = array_get($plugin, 'metaData.name');
            $version = array_get($plugin, 'metaData.version');
            if (is_dir($dir . DIRECTORY_SEPARATOR . $plugin['id'] . DIRECTORY_SEPARATOR . 'vendor')) {
                $replace[$name] = '*';
                continue;
            }
            $requires[$name] = $operation . $version;
        }
        array_set($this->data, 'require', $requires);
        array_set($this->data, 'replace', $replace);
        // set fix mode
        $this->setFixMode();
        return $this;
    }

Usage Example

 /**
  * 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__ . ".");
 }
All Usage Examples Of Xpressengine\Plugin\Composer\ComposerFileWriter::reset