Update symfony to 6.3 and upgrade some classes
This commit is contained in:
@ -34,23 +34,28 @@ class RestoreDatabaseCommand extends Command
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$question = $this->getHelper('question');
|
||||
$db = $this->getDatabaseName($input, $output);
|
||||
$fileName = $input->getArgument('file');
|
||||
if (!$fileName){
|
||||
$finder = new Finder();
|
||||
$finder->in(__DIR__ . '/../..');
|
||||
$files = [];
|
||||
foreach ($finder->files()->name('*_backup.sql') as $file) {
|
||||
$files[] = $file->getFilename();
|
||||
}
|
||||
sort($files);
|
||||
$selectQuestion = new ChoiceQuestion('Backup name (*_backup.sql): ', $files);
|
||||
$fileName = $question->ask($input, $output, $selectQuestion);
|
||||
$fileName = $this->getFileName($input, $output);
|
||||
}
|
||||
|
||||
$this->bs->restore($db, $fileName);
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
private function getFileName(InputInterface $input, OutputInterface $output): string
|
||||
{
|
||||
$finder = new Finder();
|
||||
$finder->in(__DIR__ . '/../..');
|
||||
$files = [];
|
||||
foreach ($finder->files()->name('*_backup.sql') as $file) {
|
||||
$files[] = $file->getFilename();
|
||||
}
|
||||
sort($files);
|
||||
$selectQuestion = new ChoiceQuestion('Backup name (*_backup.sql): ', $files);
|
||||
$question = $this->getHelper('question');
|
||||
return $question->ask($input, $output, $selectQuestion);
|
||||
}
|
||||
}
|
@ -8,7 +8,9 @@ use Symfony\Component\Process\Process;
|
||||
|
||||
class BackupService
|
||||
{
|
||||
public function __construct(private DatabaseCredentials $credentials)
|
||||
public function __construct(
|
||||
private readonly DatabaseCredentials $credentials
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ class DatabaseService
|
||||
private mysqli $conn;
|
||||
|
||||
public function __construct(
|
||||
private MysqliConnection $service
|
||||
private readonly MysqliConnection $service
|
||||
)
|
||||
{
|
||||
$this->conn = $this->service->getConnection();
|
||||
|
Reference in New Issue
Block a user