Skip to content

Commit

Permalink
Added information on selected database name
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbieniek committed Mar 18, 2020
1 parent 0989efc commit c5c3af9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/bundle/Command/DatabaseHealthCheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -57,14 +59,18 @@ 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,
LocationService $locationService,
SiteAccess $siteAccess,
PermissionResolver $permissionResolver,
Handler $handler,
Repository $repository
Repository $repository,
Connection $connection
) {
$this->contentGateway = $contentGateway;
$this->contentService = $contentService;
Expand All @@ -73,6 +79,7 @@ public function __construct(
$this->permissionResolver = $permissionResolver;
$this->persistenceHandler = $handler;
$this->repository = $repository;
$this->connection = $connection;

parent::__construct();
}
Expand Down Expand Up @@ -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: <info>%s</info>', $this->connection->getDatabase())
);

$this->io->warning(
'Fixing corruption will modify your database! Always perform the database backup before running this command!'
);
Expand Down
1 change: 1 addition & 0 deletions src/bundle/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }

Expand Down

0 comments on commit c5c3af9

Please sign in to comment.