mirror of
https://github.com/nextcloud/server.git
synced 2026-03-27 04:43:20 -04:00
fix(db)!: Remove private legacy event because we can not keep it
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
86310a35b2
commit
ab70bbd3ff
6 changed files with 9 additions and 91 deletions
|
|
@ -92,8 +92,6 @@ use OCP\Lock\ILockingProvider;
|
|||
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 {
|
||||
|
|
@ -110,8 +108,6 @@ class CheckSetupController extends Controller {
|
|||
/** @var LoggerInterface */
|
||||
private $logger;
|
||||
/** @var IEventDispatcher */
|
||||
private $eventDispatcher;
|
||||
/** @var EventDispatcherInterface */
|
||||
private $dispatcher;
|
||||
/** @var Connection */
|
||||
private $db;
|
||||
|
|
@ -144,8 +140,7 @@ class CheckSetupController extends Controller {
|
|||
IL10N $l10n,
|
||||
Checker $checker,
|
||||
LoggerInterface $logger,
|
||||
IEventDispatcher $eventDispatcher,
|
||||
EventDispatcherInterface $dispatcher,
|
||||
IEventDispatcher $dispatcher,
|
||||
Connection $db,
|
||||
ILockingProvider $lockingProvider,
|
||||
IDateTimeFormatter $dateTimeFormatter,
|
||||
|
|
@ -165,7 +160,6 @@ class CheckSetupController extends Controller {
|
|||
$this->l10n = $l10n;
|
||||
$this->checker = $checker;
|
||||
$this->logger = $logger;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->db = $db;
|
||||
$this->lockingProvider = $lockingProvider;
|
||||
|
|
@ -553,11 +547,8 @@ Raw output
|
|||
$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 !== []) {
|
||||
|
|
@ -577,12 +568,9 @@ Raw output
|
|||
|
||||
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)) {
|
||||
|
|
@ -602,12 +590,9 @@ Raw output
|
|||
|
||||
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)) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ use OCP\Notification\IManager;
|
|||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
/**
|
||||
|
|
@ -89,8 +88,6 @@ class CheckSetupControllerTest extends 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;
|
||||
|
|
@ -140,9 +137,7 @@ class CheckSetupControllerTest extends TestCase {
|
|||
->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();
|
||||
|
|
@ -171,7 +166,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
$this->l10n,
|
||||
$this->checker,
|
||||
$this->logger,
|
||||
$this->eventDispatcher,
|
||||
$this->dispatcher,
|
||||
$this->db,
|
||||
$this->lockingProvider,
|
||||
|
|
@ -681,7 +675,6 @@ class CheckSetupControllerTest extends TestCase {
|
|||
$this->l10n,
|
||||
$this->checker,
|
||||
$this->logger,
|
||||
$this->eventDispatcher,
|
||||
$this->dispatcher,
|
||||
$this->db,
|
||||
$this->lockingProvider,
|
||||
|
|
@ -1409,7 +1402,6 @@ Array
|
|||
$this->l10n,
|
||||
$this->checker,
|
||||
$this->logger,
|
||||
$this->eventDispatcher,
|
||||
$this->dispatcher,
|
||||
$this->db,
|
||||
$this->lockingProvider,
|
||||
|
|
@ -1464,7 +1456,6 @@ Array
|
|||
$this->l10n,
|
||||
$this->checker,
|
||||
$this->logger,
|
||||
$this->eventDispatcher,
|
||||
$this->dispatcher,
|
||||
$this->db,
|
||||
$this->lockingProvider,
|
||||
|
|
|
|||
|
|
@ -29,15 +29,11 @@ namespace OC\Core\Command\Db;
|
|||
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
|
||||
|
|
@ -50,7 +46,6 @@ use Symfony\Component\EventDispatcher\GenericEvent;
|
|||
class AddMissingColumns extends Command {
|
||||
public function __construct(
|
||||
private Connection $connection,
|
||||
private EventDispatcherInterface $legacyDispatcher,
|
||||
private IEventDispatcher $dispatcher,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
|
@ -67,9 +62,6 @@ class AddMissingColumns extends Command {
|
|||
$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();
|
||||
|
|
|
|||
|
|
@ -33,18 +33,14 @@ declare(strict_types=1);
|
|||
*/
|
||||
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
|
||||
|
|
@ -57,8 +53,7 @@ use Symfony\Component\EventDispatcher\GenericEvent;
|
|||
class AddMissingIndices extends Command {
|
||||
public function __construct(
|
||||
private Connection $connection,
|
||||
private IEventDispatcher $eventDispatcher,
|
||||
private EventDispatcherInterface $dispatcher,
|
||||
private IEventDispatcher $dispatcher,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
@ -74,11 +69,8 @@ class AddMissingIndices extends Command {
|
|||
$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 !== []) {
|
||||
|
|
|
|||
|
|
@ -28,17 +28,12 @@ namespace OC\Core\Command\Db;
|
|||
|
||||
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
|
||||
|
|
@ -51,7 +46,6 @@ use function Symfony\Component\Translation\t;
|
|||
class AddMissingPrimaryKeys extends Command {
|
||||
public function __construct(
|
||||
private Connection $connection,
|
||||
private EventDispatcherInterface $legacyDispatcher,
|
||||
private IEventDispatcher $dispatcher,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
|
@ -68,9 +62,6 @@ class AddMissingPrimaryKeys extends Command {
|
|||
$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();
|
||||
|
|
|
|||
|
|
@ -34,9 +34,6 @@
|
|||
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;
|
||||
|
|
@ -48,36 +45,6 @@ use OCP\DB\QueryBuilder\IQueryBuilder;
|
|||
* @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.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue