diff --git a/app/config/config_dev.yml b/app/config/config_dev.yml index 08f10cb..b31b24c 100644 --- a/app/config/config_dev.yml +++ b/app/config/config_dev.yml @@ -22,7 +22,7 @@ monolog: console: type: console verbosity_levels: - VERBOSITY_NORMAL: INFO + VERBOSITY_NORMAL: WARNING channels: [!event, !doctrine] # uncomment to get logging in your browser # you may have to allow bigger header sizes in your Web server configuration diff --git a/src/Skobkin/Bundle/PointToolsBundle/Command/UpdateSubscriptionsCommand.php b/src/Skobkin/Bundle/PointToolsBundle/Command/UpdateSubscriptionsCommand.php index eb49b89..5996b62 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Command/UpdateSubscriptionsCommand.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Command/UpdateSubscriptionsCommand.php @@ -10,6 +10,7 @@ use Skobkin\Bundle\PointToolsBundle\Repository\UserRepository; use Skobkin\Bundle\PointToolsBundle\Service\SubscriptionsManager; use Skobkin\Bundle\PointToolsBundle\Service\UserApi; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -51,6 +52,11 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand */ private $subscriptionManager; + /** + * @var ProgressBar + */ + private $progress; + public function setLogger(LoggerInterface $logger) { @@ -118,9 +124,14 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand return 1; } + $this->progress = new ProgressBar($output); + $this->progress->setFormat('debug'); + // Beginning transaction for all changes $this->em->beginTransaction(); + $this->progress->setMessage('Getting service subscribers'); + try { $usersForUpdate = $this->getUsersForUpdate($appUserId); } catch (\Exception $e) { @@ -136,9 +147,13 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand } $this->logger->info('Processing users subscribers'); + $this->progress->setMessage('Processing users subscribers'); + $this->progress->start(count($usersForUpdate)); $this->updateUsersSubscribers($usersForUpdate); + $this->progress->finish(); + // Flushing all changes at once to database $this->em->flush(); $this->em->commit(); @@ -192,6 +207,8 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand ); } + $this->progress->advance(); + usleep($this->apiDelay); } }