BUGFIX: resolved deprecations

This commit is contained in:
Jeroen De Meerleer 2022-10-04 12:17:28 +02:00
parent 3c2e2e2a03
commit 24da51ffd8
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
6 changed files with 12 additions and 13 deletions

View File

@ -8,12 +8,14 @@ use App\Entity\Run;
use Doctrine\DBAL\Exception; use Doctrine\DBAL\Exception;
use App\Repository\RunRepository; use App\Repository\RunRepository;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
#[AsCommand(name: 'webcron:cleanup', description: 'Cleanup runs')]
class CleanupCommand extends Command class CleanupCommand extends Command
{ {
protected static $defaultName = 'webcron:cleanup'; protected static $defaultName = 'webcron:cleanup';
@ -30,8 +32,6 @@ class CleanupCommand extends Command
protected function configure() protected function configure()
{ {
$this $this
->setDescription('Cleanup runs')
->setHelp('This command cleans the runs table')
->addOption('jobid', 'j', InputOption::VALUE_IS_ARRAY + InputOption::VALUE_REQUIRED, 'The ids of the jobs to clean') ->addOption('jobid', 'j', InputOption::VALUE_IS_ARRAY + InputOption::VALUE_REQUIRED, 'The ids of the jobs to clean')
->addOption('maxage', 'm', InputOption::VALUE_REQUIRED, 'The maximum age of the oldest runs'); ->addOption('maxage', 'm', InputOption::VALUE_REQUIRED, 'The maximum age of the oldest runs');
} }

View File

@ -6,17 +6,16 @@ namespace App\Command;
use App\Entity\Job; use App\Entity\Job;
use App\Repository\JobRepository; use App\Repository\JobRepository;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
#[AsCommand(name: 'webcron:daemon', description: 'The master script of Webcron Management')]
class DaemonCommand extends Command class DaemonCommand extends Command
{ {
protected static $defaultName = 'webcron:daemon';
protected $kernel; protected $kernel;
protected $doctrine; protected $doctrine;
@ -31,7 +30,6 @@ class DaemonCommand extends Command
protected function configure() protected function configure()
{ {
$this $this
->setDescription('The deamon slayer of webcron')
->setHelp('This command is the daemon process of webcron, enabling webcron to actually run jobs on time') ->setHelp('This command is the daemon process of webcron, enabling webcron to actually run jobs on time')
->addOption('time-limit', 't', InputOption::VALUE_REQUIRED, 'Time limit in seconds before stopping the daemon.') ->addOption('time-limit', 't', InputOption::VALUE_REQUIRED, 'Time limit in seconds before stopping the daemon.')
->addOption('async', 'a', InputOption::VALUE_NEGATABLE, 'Time limit in seconds before stopping the daemon.'); ->addOption('async', 'a', InputOption::VALUE_NEGATABLE, 'Time limit in seconds before stopping the daemon.');

View File

@ -8,6 +8,7 @@ use App\Entity\User;
use App\Repository\RunRepository; use App\Repository\RunRepository;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
@ -15,9 +16,9 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
#[AsCommand(name: 'webcron:demodata', description: 'Install demo data')]
class DemoInstallCommand extends Command class DemoInstallCommand extends Command
{ {
protected static $defaultName = 'webcron:demodata';
protected $kernel; protected $kernel;
protected $doctrine; protected $doctrine;
protected $passwordHasher; protected $passwordHasher;
@ -33,7 +34,6 @@ class DemoInstallCommand extends Command
protected function configure() protected function configure()
{ {
$this $this
->setDescription('Install demo data')
->setHelp('This command installs the demo data'); ->setHelp('This command installs the demo data');
} }

View File

@ -7,6 +7,7 @@ use App\Entity\User;
use App\Repository\JobRepository; use App\Repository\JobRepository;
use App\Repository\UserRepository; use App\Repository\UserRepository;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
@ -19,9 +20,9 @@ use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Email; use Symfony\Component\Mime\Email;
use Twig\Environment; use Twig\Environment;
#[AsCommand(name: 'webcron:mail-failed-runs', description: 'Sends email about failed runs')]
class MailFailedRunsCommand extends Command class MailFailedRunsCommand extends Command
{ {
protected static $defaultName = 'webcron:mail-failed-runs';
protected $kernel; protected $kernel;
protected $doctrine; protected $doctrine;
protected $templating; protected $templating;
@ -39,7 +40,6 @@ class MailFailedRunsCommand extends Command
protected function configure() protected function configure()
{ {
$this $this
->setDescription('Sends email about failed runs')
->setHelp('This command will send emails to the users when jobs are failing') ->setHelp('This command will send emails to the users when jobs are failing')
->addArgument('recipients', InputArgument::REQUIRED + InputArgument::IS_ARRAY, 'Which e-mailaddress should receive the notifications'); ->addArgument('recipients', InputArgument::REQUIRED + InputArgument::IS_ARRAY, 'Which e-mailaddress should receive the notifications');
} }

View File

@ -4,15 +4,16 @@ namespace App\Command;
use App\Entity\Job; use App\Entity\Job;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
#[AsCommand(name: 'webcron:run', description: 'Run a single cronjob')]
class RunCommand extends Command class RunCommand extends Command
{ {
protected static $defaultName = 'webcron:run';
protected $kernel; protected $kernel;
protected $doctrine; protected $doctrine;
@ -26,7 +27,6 @@ class RunCommand extends Command
protected function configure() protected function configure()
{ {
$this $this
->setDescription('Run a single cronjob')
->setHelp('This command runs a single command') ->setHelp('This command runs a single command')
->addArgument('jobid', InputArgument::REQUIRED, 'The id of the job to be run'); ->addArgument('jobid', InputArgument::REQUIRED, 'The id of the job to be run');
} }

View File

@ -8,6 +8,7 @@ use App\Entity\User;
use App\Repository\RunRepository; use App\Repository\RunRepository;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Completion\CompletionInput; use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Completion\CompletionSuggestions; use Symfony\Component\Console\Completion\CompletionSuggestions;
@ -21,6 +22,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
#[AsCommand(name: 'webcron:user', description: 'User stuff')]
class UserCommand extends Command class UserCommand extends Command
{ {
protected static $defaultName = 'webcron:user'; protected static $defaultName = 'webcron:user';
@ -48,7 +50,6 @@ class UserCommand extends Command
protected function configure() protected function configure()
{ {
$this $this
->setDescription('User stuff')
->setHelp('The command is doing user stuff') ->setHelp('The command is doing user stuff')
->addArgument('action', InputArgument::REQUIRED, 'What action should be executed? [add, delete, update]', null, ['add', 'update', 'delete']) ->addArgument('action', InputArgument::REQUIRED, 'What action should be executed? [add, delete, update]', null, ['add', 'update', 'delete'])
->addOption('username', 'u', InputOption::VALUE_OPTIONAL, 'What action should be executed? [add, delete, update]', '') ->addOption('username', 'u', InputOption::VALUE_OPTIONAL, 'What action should be executed? [add, delete, update]', '')