/** * @param InputInterface $input * @param OutputInterface $output * @return int|null|void */ protected function execute(InputInterface $input, OutputInterface $output) { parent::bootstrapProcessWire($output); $dev = $input->getOption('dev') ? true : false; $check = parent::checkForCoreUpgrades($output, $dev); $this->output = $output; $this->root = wire('config')->paths->root; if ($check['upgrade'] && $input->getOption('just-check') === false) { if (!extension_loaded('pdo_mysql')) { $this->output->writeln("<error>Your PHP is not compiled with PDO support. PDO is required by ProcessWire 2.4+.</error>"); } elseif (!class_exists('ZipArchive')) { $this->output->writeln("<error>Your PHP does not have ZipArchive support. This is required to install core or module upgrades with this tool.</error>"); } elseif (!is_writable($this->root)) { $this->output->writeln("<error>Your file system is not writable.</error>"); } else { $this->fs = new Filesystem(); $this->projectDir = $this->fs->isAbsolutePath($this->root) ? $this->root : getcwd() . DIRECTORY_SEPARATOR . $this->root; $this->branch = $check['branch']; try { $this->download()->extract()->move()->cleanup()->replace($input->getOption('just-download'), $input, $output); } catch (Exception $e) { } } } }