From 17ff6f34fcc3778797998efeb5194a9a50b95c4e Mon Sep 17 00:00:00 2001 From: Kevin Porras Date: Tue, 8 Feb 2022 10:20:16 -0600 Subject: [PATCH] Add option to ignore phar running check. --- src/SelfUpdateCommand.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/SelfUpdateCommand.php b/src/SelfUpdateCommand.php index e874876..c10ed29 100644 --- a/src/SelfUpdateCommand.php +++ b/src/SelfUpdateCommand.php @@ -26,15 +26,26 @@ class SelfUpdateCommand extends Command protected $applicationName; + protected $ignorePharRunningCheck; + public function __construct($applicationName = null, $currentVersion = null, $gitHubRepository = null) { $this->applicationName = $applicationName; $this->currentVersion = $currentVersion; $this->gitHubRepository = $gitHubRepository; + $this->ignorePharRunningCheck = false; parent::__construct(self::SELF_UPDATE_COMMAND_NAME); } + /** + * Set ignorePharRunningCheck to true. + */ + public function ignorePharRunningCheck($ignore = true) + { + $this->ignorePharRunningCheck = $ignore; + } + /** * {@inheritdoc} */ @@ -163,7 +174,7 @@ public function getLatestReleaseFromGithub(array $options) */ protected function execute(InputInterface $input, OutputInterface $output) { - if (empty(\Phar::running())) { + if (!$this->ignorePharRunningCheck && empty(\Phar::running())) { throw new \Exception(self::SELF_UPDATE_COMMAND_NAME . ' only works when running the phar version of ' . $this->applicationName . '.'); }