From c5c3af938166018e5a109409c1d767b5fbaa6873 Mon Sep 17 00:00:00 2001 From: Mateusz Bieniek Date: Wed, 18 Mar 2020 13:15:39 +0100 Subject: [PATCH] Added information on selected database name --- src/bundle/Command/DatabaseHealthCheckCommand.php | 13 ++++++++++++- src/bundle/Resources/config/services.yml | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/bundle/Command/DatabaseHealthCheckCommand.php b/src/bundle/Command/DatabaseHealthCheckCommand.php index 59011fa..4a0200b 100644 --- a/src/bundle/Command/DatabaseHealthCheckCommand.php +++ b/src/bundle/Command/DatabaseHealthCheckCommand.php @@ -4,6 +4,8 @@ namespace MateuszBieniek\EzPlatformDatabaseHealthCheckerBundle\Command; +use Doctrine\DBAL\Connection; +use eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryConfigurationProvider; use eZ\Publish\API\Repository\ContentService; use eZ\Publish\API\Repository\LocationService; use eZ\Publish\API\Repository\PermissionResolver; @@ -57,6 +59,9 @@ class DatabaseHealthCheckCommand extends Command /** @var \Symfony\Component\Console\Style\SymfonyStyle */ private $io; + /** @var \eZ\Bundle\EzPublishCoreBundle\ApiLoader\RepositoryConfigurationProvider */ + private $repositoryConfigurationProvider; + public function __construct( ContentGateway $contentGateway, ContentService $contentService, @@ -64,7 +69,8 @@ public function __construct( SiteAccess $siteAccess, PermissionResolver $permissionResolver, Handler $handler, - Repository $repository + Repository $repository, + Connection $connection ) { $this->contentGateway = $contentGateway; $this->contentService = $contentService; @@ -73,6 +79,7 @@ public function __construct( $this->permissionResolver = $permissionResolver; $this->persistenceHandler = $handler; $this->repository = $repository; + $this->connection = $connection; parent::__construct(); } @@ -124,6 +131,10 @@ protected function initialize(InputInterface $input, OutputInterface $output): v protected function execute(InputInterface $input, OutputInterface $output): void { $this->io->title('eZ Platform Database Health Checker'); + $this->io->text( + sprintf('Using database: %s', $this->connection->getDatabase()) + ); + $this->io->warning( 'Fixing corruption will modify your database! Always perform the database backup before running this command!' ); diff --git a/src/bundle/Resources/config/services.yml b/src/bundle/Resources/config/services.yml index 276806a..d377573 100644 --- a/src/bundle/Resources/config/services.yml +++ b/src/bundle/Resources/config/services.yml @@ -15,6 +15,7 @@ services: $permissionResolver: '@eZ\Publish\API\Repository\PermissionResolver' $handler: '@ezpublish.api.storage_engine' $repository: '@ezpublish.api.repository' + $connection: '@ezpublish.persistence.connection' tags: - { name: 'console.command', command: 'ezplatform:database-health-check' }