Using --dry-run for app commands.
This commit is contained in:
parent
bae8ee9a24
commit
1c223f7077
|
@ -40,7 +40,7 @@ class ImportUsersCommand extends Command
|
||||||
'CSV file path'
|
'CSV file path'
|
||||||
)
|
)
|
||||||
->addOption(
|
->addOption(
|
||||||
'check-only',
|
'dry-run',
|
||||||
null,
|
null,
|
||||||
InputOption::VALUE_NONE,
|
InputOption::VALUE_NONE,
|
||||||
'If set, command will not perform write operations in the database'
|
'If set, command will not perform write operations in the database'
|
||||||
|
@ -89,7 +89,7 @@ class ImportUsersCommand extends Command
|
||||||
|
|
||||||
$user = new User($row[0], $createdAt, $row[1], $row[2]);
|
$user = new User($row[0], $createdAt, $row[1], $row[2]);
|
||||||
|
|
||||||
if (!$input->getOption('check-only')) {
|
if (!$input->getOption('dry-run')) {
|
||||||
$this->em->persist($user);
|
$this->em->persist($user);
|
||||||
$this->em->flush($user);
|
$this->em->flush($user);
|
||||||
$this->em->detach($user);
|
$this->em->detach($user);
|
||||||
|
|
|
@ -50,7 +50,7 @@ class TelegramSendMessageCommand extends Command
|
||||||
try {
|
try {
|
||||||
$this->messenger->sendMessageToChat(
|
$this->messenger->sendMessageToChat(
|
||||||
(int) $input->getOption('chat-id'),
|
(int) $input->getOption('chat-id'),
|
||||||
$message
|
$message,
|
||||||
);
|
);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$io->error($e->getMessage());
|
$io->error($e->getMessage());
|
||||||
|
|
|
@ -42,7 +42,7 @@ class UpdateSubscriptionsCommand extends Command
|
||||||
'If set, command will check subscribers of all service users instead of service subscribers only'
|
'If set, command will check subscribers of all service users instead of service subscribers only'
|
||||||
)
|
)
|
||||||
->addOption(
|
->addOption(
|
||||||
'check-only',
|
'dry-run',
|
||||||
null,
|
null,
|
||||||
InputOption::VALUE_NONE,
|
InputOption::VALUE_NONE,
|
||||||
'If set, command will not perform write operations in the database'
|
'If set, command will not perform write operations in the database'
|
||||||
|
@ -59,7 +59,7 @@ class UpdateSubscriptionsCommand extends Command
|
||||||
$progress = $io->createProgressBar();
|
$progress = $io->createProgressBar();
|
||||||
$progress->setFormat(ProgressBar::FORMAT_DEBUG);
|
$progress->setFormat(ProgressBar::FORMAT_DEBUG);
|
||||||
|
|
||||||
if (!$input->getOption('check-only')) { // Beginning transaction for all changes
|
if (!$input->getOption('dry-run')) { // Beginning transaction for all changes
|
||||||
$this->em->beginTransaction();
|
$this->em->beginTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue