mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-03 22:03:13 +08:00
34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Shlinkio\Shlink\CLI\Command\Db;
|
|
|
|
use Shlinkio\Shlink\CLI\Command\Util\AbstractLockedCommand;
|
|
use Symfony\Component\Console\Helper\ProcessHelper;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
use Symfony\Component\Lock\Factory as Locker;
|
|
use Symfony\Component\Process\PhpExecutableFinder;
|
|
|
|
use function array_unshift;
|
|
|
|
abstract class AbstractDatabaseCommand extends AbstractLockedCommand
|
|
{
|
|
/** @var ProcessHelper */
|
|
private $processHelper;
|
|
/** @var string */
|
|
private $phpBinary;
|
|
|
|
public function __construct(Locker $locker, ProcessHelper $processHelper, PhpExecutableFinder $phpFinder)
|
|
{
|
|
parent::__construct($locker);
|
|
$this->processHelper = $processHelper;
|
|
$this->phpBinary = $phpFinder->find(false) ?: 'php';
|
|
}
|
|
|
|
protected function runPhpCommand(OutputInterface $output, array $command): void
|
|
{
|
|
array_unshift($command, $this->phpBinary);
|
|
$this->processHelper->run($output, $command, null, null, $output->getVerbosity());
|
|
}
|
|
}
|