diff --git a/core/composer.json b/core/composer.json index e32736730a..1d0de96d8d 100644 --- a/core/composer.json +++ b/core/composer.json @@ -75,6 +75,7 @@ "phpmailer/phpmailer": "7.*", "phpoption/phpoption": "*", "predis/predis": "*", + "rosell-dk/exec-with-fallback": "*", "rosell-dk/webp-convert": "*", "secondnetwork/blade-tabler-icons": "^3.46", "simplepie/simplepie": "1.*", diff --git a/core/src/Console/Packages/ExtrasCommand.php b/core/src/Console/Packages/ExtrasCommand.php index 098db6b85d..1679a156e7 100644 --- a/core/src/Console/Packages/ExtrasCommand.php +++ b/core/src/Console/Packages/ExtrasCommand.php @@ -1,8 +1,7 @@ NUL 2>NUL' : 'command -v ' . escapeshellarg($command) . ' >/dev/null 2>&1'; - exec($probe, $output, $exitCode); + ExecWithFallback::exec($probe, $output, $exitCode); return (int) $exitCode === 0; } @@ -1013,7 +1014,7 @@ protected function normalizeUpdateRepository(string $repository): string protected function runCoreShellCommand(string $command): void { $fullCommand = 'cd ' . escapeshellarg(EVO_CORE_PATH) . ' && ' . $command . ' 2>&1'; - exec($fullCommand, $output, $exitCode); + ExecWithFallback::exec($fullCommand, $output, $exitCode); if ((int) $exitCode !== 0) { $message = 'Command failed: ' . $command; diff --git a/install/cli-install.php b/install/cli-install.php index 1550362bf8..4b6393a43a 100644 --- a/install/cli-install.php +++ b/install/cli-install.php @@ -1,5 +1,6 @@ &1', $out, $exitCode); - echo implode(PHP_EOL, $out), PHP_EOL; - } elseif (!in_array('shell_exec', $disabled, true)) { - $output = shell_exec($cmd . ' 2>&1'); - $exitCode = (is_string($output) && $output !== '') ? 0 : 1; - echo $output; - } else { - info('- The passthru/exec/shell_exec functions are disabled in php.ini.'); - warning('⚠ Run "composer update" manually.'); - return; - } - - if ($exitCode === 0) { - success('✔ Dependencies updated successfully.'); - } else { - error("✖ Composer finished with the code {$exitCode}."); - warning('⚠ Make sure you have execute permissions and try "composer update" manually.'); - } + $this->runComposerUpdate($cmd); } public function realInstall()