use OCP\Notification\IManager;
use OCP\Security\ISecureRandom;
use Psr\Log\LoggerInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-use Symfony\Component\EventDispatcher\GenericEvent;
#[IgnoreOpenAPI]
class CheckSetupController extends Controller {
/** @var LoggerInterface */
private $logger;
/** @var IEventDispatcher */
- private $eventDispatcher;
- /** @var EventDispatcherInterface */
private $dispatcher;
/** @var Connection */
private $db;
IL10N $l10n,
Checker $checker,
LoggerInterface $logger,
- IEventDispatcher $eventDispatcher,
- EventDispatcherInterface $dispatcher,
+ IEventDispatcher $dispatcher,
Connection $db,
ILockingProvider $lockingProvider,
IDateTimeFormatter $dateTimeFormatter,
$this->l10n = $l10n;
$this->checker = $checker;
$this->logger = $logger;
- $this->eventDispatcher = $eventDispatcher;
$this->dispatcher = $dispatcher;
$this->db = $db;
$this->lockingProvider = $lockingProvider;
$indexInfo = new MissingIndexInformation();
// Dispatch event so apps can also hint for pending index updates if needed
- $event = new GenericEvent($indexInfo);
- $this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_INDEXES_EVENT, $event);
-
$event = new AddMissingIndicesEvent();
- $this->eventDispatcher->dispatchTyped($event);
+ $this->dispatcher->dispatchTyped($event);
$missingIndices = $event->getMissingIndices();
if ($missingIndices !== []) {
protected function hasMissingPrimaryKeys(): array {
$info = new MissingPrimaryKeyInformation();
- // Dispatch event so apps can also hint for pending index updates if needed
- $event = new GenericEvent($info);
- $this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_PRIMARY_KEYS_EVENT, $event);
-
+ // Dispatch event so apps can also hint for pending key updates if needed
$event = new AddMissingPrimaryKeyEvent();
- $this->eventDispatcher->dispatchTyped($event);
+ $this->dispatcher->dispatchTyped($event);
$missingKeys = $event->getMissingPrimaryKeys();
if (!empty($missingKeys)) {
protected function hasMissingColumns(): array {
$columnInfo = new MissingColumnInformation();
- // Dispatch event so apps can also hint for pending index updates if needed
- $event = new GenericEvent($columnInfo);
- $this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, $event);
-
+ // Dispatch event so apps can also hint for pending column updates if needed
$event = new AddMissingColumnsEvent();
- $this->eventDispatcher->dispatchTyped($event);
+ $this->dispatcher->dispatchTyped($event);
$missingColumns = $event->getMissingColumns();
if (!empty($missingColumns)) {
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Http\Message\ResponseInterface;
use Psr\Log\LoggerInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
/**
/** @var Checker|\PHPUnit\Framework\MockObject\MockObject */
private $checker;
/** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */
- private $eventDispatcher;
- /** @var EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject */
private $dispatcher;
/** @var Connection|\PHPUnit\Framework\MockObject\MockObject */
private $db;
->willReturnCallback(function ($message, array $replace) {
return vsprintf($message, $replace);
});
- $this->eventDispatcher = $this->createMock(IEventDispatcher::class);
- $this->dispatcher = $this->getMockBuilder(EventDispatcherInterface::class)
- ->disableOriginalConstructor()->getMock();
+ $this->dispatcher = $this->createMock(IEventDispatcher::class);
$this->checker = $this->getMockBuilder('\OC\IntegrityCheck\Checker')
->disableOriginalConstructor()->getMock();
$this->logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
$this->l10n,
$this->checker,
$this->logger,
- $this->eventDispatcher,
$this->dispatcher,
$this->db,
$this->lockingProvider,
$this->l10n,
$this->checker,
$this->logger,
- $this->eventDispatcher,
$this->dispatcher,
$this->db,
$this->lockingProvider,
$this->l10n,
$this->checker,
$this->logger,
- $this->eventDispatcher,
$this->dispatcher,
$this->db,
$this->lockingProvider,
$this->l10n,
$this->checker,
$this->logger,
- $this->eventDispatcher,
$this->dispatcher,
$this->db,
$this->lockingProvider,
use OC\DB\Connection;
use OC\DB\SchemaWrapper;
use OCP\DB\Events\AddMissingColumnsEvent;
-use OCP\DB\Types;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\IDBConnection;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class AddMissingColumns
class AddMissingColumns extends Command {
public function __construct(
private Connection $connection,
- private EventDispatcherInterface $legacyDispatcher,
private IEventDispatcher $dispatcher,
) {
parent::__construct();
$dryRun = $input->getOption('dry-run');
// Dispatch event so apps can also update columns if needed
- $event = new GenericEvent($output);
- $this->legacyDispatcher->dispatch(IDBConnection::ADD_MISSING_COLUMNS_EVENT, $event);
-
$event = new AddMissingColumnsEvent();
$this->dispatcher->dispatchTyped($event);
$missingColumns = $event->getMissingColumns();
*/
namespace OC\Core\Command\Db;
-use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use OC\DB\Connection;
use OC\DB\SchemaWrapper;
use OCP\DB\Events\AddMissingIndicesEvent;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\IDBConnection;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class AddMissingIndices
class AddMissingIndices extends Command {
public function __construct(
private Connection $connection,
- private IEventDispatcher $eventDispatcher,
- private EventDispatcherInterface $dispatcher,
+ private IEventDispatcher $dispatcher,
) {
parent::__construct();
}
$dryRun = $input->getOption('dry-run');
// Dispatch event so apps can also update indexes if needed
- $event = new GenericEvent($output);
- $this->dispatcher->dispatch(IDBConnection::ADD_MISSING_INDEXES_EVENT, $event);
-
$event = new AddMissingIndicesEvent();
- $this->eventDispatcher->dispatchTyped($event);
+ $this->dispatcher->dispatchTyped($event);
$missingIndices = $event->getMissingIndices();
if ($missingIndices !== []) {
use OC\DB\Connection;
use OC\DB\SchemaWrapper;
-use OCP\DB\Events\AddMissingColumnsEvent;
use OCP\DB\Events\AddMissingPrimaryKeyEvent;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\IDBConnection;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-use Symfony\Component\EventDispatcher\GenericEvent;
-use function Symfony\Component\Translation\t;
/**
* Class AddMissingPrimaryKeys
class AddMissingPrimaryKeys extends Command {
public function __construct(
private Connection $connection,
- private EventDispatcherInterface $legacyDispatcher,
private IEventDispatcher $dispatcher,
) {
parent::__construct();
$dryRun = $input->getOption('dry-run');
// Dispatch event so apps can also update indexes if needed
- $event = new GenericEvent($output);
- $this->legacyDispatcher->dispatch(IDBConnection::ADD_MISSING_PRIMARY_KEYS_EVENT, $event);
-
$event = new AddMissingPrimaryKeyEvent();
$this->dispatcher->dispatchTyped($event);
$missingKeys = $event->getMissingPrimaryKeys();
namespace OCP;
use Doctrine\DBAL\Schema\Schema;
-use OCP\DB\Events\AddMissingColumnsEvent;
-use OCP\DB\Events\AddMissingIndicesEvent;
-use OCP\DB\Events\AddMissingPrimaryKeyEvent;
use OCP\DB\Exception;
use OCP\DB\IPreparedStatement;
use OCP\DB\IResult;
* @since 6.0.0
*/
interface IDBConnection {
- /**
- * @deprecated 22.0.0 this is an internal event, use {@see AddMissingIndicesEvent} instead
- */
- public const ADD_MISSING_INDEXES_EVENT = self::class . '::ADD_MISSING_INDEXES';
-
- /**
- * @deprecated 22.0.0 this is an internal event, use {@see AddMissingIndicesEvent} instead
- */
- public const CHECK_MISSING_INDEXES_EVENT = self::class . '::CHECK_MISSING_INDEXES';
-
- /**
- * @deprecated 22.0.0 this is an internal event, use {@see AddMissingPrimaryKeyEvent} instead
- */
- public const ADD_MISSING_PRIMARY_KEYS_EVENT = self::class . '::ADD_MISSING_PRIMARY_KEYS';
-
- /**
- * @deprecated 22.0.0 this is an internal event, use {@see AddMissingPrimaryKeyEvent} instead
- */
- public const CHECK_MISSING_PRIMARY_KEYS_EVENT = self::class . '::CHECK_MISSING_PRIMARY_KEYS';
-
- /**
- * @deprecated 22.0.0 this is an internal event, use {@see AddMissingColumnsEvent} instead
- */
- public const ADD_MISSING_COLUMNS_EVENT = self::class . '::ADD_MISSING_COLUMNS';
-
- /**
- * @deprecated 22.0.0 this is an internal event, use {@see AddMissingColumnsEvent} instead
- */
- public const CHECK_MISSING_COLUMNS_EVENT = self::class . '::CHECK_MISSING_COLUMNS';
-
/**
* Gets the QueryBuilder for the connection.
*