aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/DB/Migrator.php
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-08-22 16:56:01 +0200
committerCôme Chilliet <come.chilliet@nextcloud.com>2022-08-25 16:13:47 +0200
commita83a8f0dde07bff67e0ceb7008cc26b3fad32516 (patch)
treea1dcc3e67eab7f2ff56a0fc60aa3f19387b943cd /lib/private/DB/Migrator.php
parent5aac997d448da55f1c43648b1e5cf1a9c1360d6c (diff)
downloadnextcloud-server-a83a8f0dde07bff67e0ceb7008cc26b3fad32516.tar.gz
nextcloud-server-a83a8f0dde07bff67e0ceb7008cc26b3fad32516.zip
Migrate Migrator::executeSql to OCP\EventDispatcher\Event
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/DB/Migrator.php')
-rw-r--r--lib/private/DB/Migrator.php12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/private/DB/Migrator.php b/lib/private/DB/Migrator.php
index d2fdefefb39..5dc07be1d2b 100644
--- a/lib/private/DB/Migrator.php
+++ b/lib/private/DB/Migrator.php
@@ -37,9 +37,8 @@ use Doctrine\DBAL\Schema\SchemaDiff;
use Doctrine\DBAL\Types\StringType;
use Doctrine\DBAL\Types\Type;
use OCP\IConfig;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-use Symfony\Component\EventDispatcher\GenericEvent;
use function preg_match;
+use OCP\EventDispatcher\IEventDispatcher;
class Migrator {
@@ -49,15 +48,14 @@ class Migrator {
/** @var IConfig */
protected $config;
- /** @var ?EventDispatcherInterface */
- private $dispatcher;
+ private ?IEventDispatcher $dispatcher;
/** @var bool */
private $noEmit = false;
public function __construct(Connection $connection,
IConfig $config,
- ?EventDispatcherInterface $dispatcher = null) {
+ ?IEventDispatcher $dispatcher = null) {
$this->connection = $connection;
$this->config = $config;
$this->dispatcher = $dispatcher;
@@ -183,13 +181,13 @@ class Migrator {
return '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/';
}
- protected function emit($sql, $step, $max) {
+ protected function emit(string $sql, int $step, int $max): void {
if ($this->noEmit) {
return;
}
if (is_null($this->dispatcher)) {
return;
}
- $this->dispatcher->dispatch('\OC\DB\Migrator::executeSql', new GenericEvent($sql, ['step' => $step + 1, 'max' => $max]));
+ $this->dispatcher->dispatchTyped(new MigratorExecuteSqlEvent($sql, $step, $max));
}
}