Skip to content

Commit

Permalink
Merge pull request #5338 from makss/fix-php-version
Browse files Browse the repository at this point in the history
PHP version detection fix.
  • Loading branch information
pxpm authored Mar 29, 2024
2 parents 3ecaeff + 1287650 commit 63f6344
Showing 1 changed file with 6 additions and 26 deletions.
32 changes: 6 additions & 26 deletions src/app/Console/Commands/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
namespace Backpack\CRUD\app\Console\Commands;

use Illuminate\Console\Command;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;

class Version extends Command
{
Expand All @@ -30,7 +28,12 @@ class Version extends Command
public function handle()
{
$this->comment('### PHP VERSION:');
$this->runConsoleCommand(['php', '-v']);
$this->line(phpversion());
$this->line('');

$this->comment('### PHP EXTENSIONS:');
$this->line(implode(', ', get_loaded_extensions()));
$this->line('');

$this->comment('### LARAVEL VERSION:');
$this->line(\Composer\InstalledVersions::getVersion('laravel/framework'));
Expand All @@ -44,27 +47,4 @@ public function handle()
}
}
}

/**
* Run a shell command in a separate process.
*
* @param array $command Text to be executed.
* @return void
*/
private function runConsoleCommand($command)
{
$process = new Process($command, null, null, null, 60, null);
$process->run(function ($type, $buffer) {
if (Process::ERR === $type) {
$this->line($buffer);
} else {
$this->line($buffer);
}
});

// executes after the command finishes
if (! $process->isSuccessful()) {
throw new ProcessFailedException($process);
}
}
}

0 comments on commit 63f6344

Please sign in to comment.