v0.5.0
This commit is contained in:
36
app/common/Command/UpdateIp.php
Normal file
36
app/common/Command/UpdateIp.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
namespace ProVM\Command;
|
||||
|
||||
use Exception;
|
||||
use PDOException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use ProVM\Service\Remote;
|
||||
|
||||
#[AsCommand(
|
||||
name: 'update',
|
||||
hidden: false
|
||||
)]
|
||||
class UpdateIp extends Command
|
||||
{
|
||||
public function __construct(protected Remote $service, protected LoggerInterface $logger, ?string $name = 'update')
|
||||
{
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
try {
|
||||
$this->service->update();
|
||||
return Command::SUCCESS;
|
||||
} catch (PDOException $e) {
|
||||
$this->logger->warning($e);
|
||||
return Command::FAILURE;
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error($e);
|
||||
return Command::FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user