Skip to content

Commit 79aa84b

Browse files
authored
Merge pull request #4521 from nextcloud/bugfix/noid/add-missing-index-steps
2 parents fbec37c + b953ddb commit 79aa84b

6 files changed

Lines changed: 68 additions & 14 deletions

File tree

composer.lock

Lines changed: 19 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
'OCA\\Text\\Exception\\InvalidSessionException' => $baseDir . '/../lib/Exception/InvalidSessionException.php',
3535
'OCA\\Text\\Exception\\UploadException' => $baseDir . '/../lib/Exception/UploadException.php',
3636
'OCA\\Text\\Exception\\VersionMismatchException' => $baseDir . '/../lib/Exception/VersionMismatchException.php',
37+
'OCA\\Text\\Listeners\\AddMissingIndicesListener' => $baseDir . '/../lib/Listeners/AddMissingIndicesListener.php',
3738
'OCA\\Text\\Listeners\\BeforeNodeDeletedListener' => $baseDir . '/../lib/Listeners/BeforeNodeDeletedListener.php',
3839
'OCA\\Text\\Listeners\\BeforeNodeRenamedListener' => $baseDir . '/../lib/Listeners/BeforeNodeRenamedListener.php',
3940
'OCA\\Text\\Listeners\\FilesLoadAdditionalScriptsListener' => $baseDir . '/../lib/Listeners/FilesLoadAdditionalScriptsListener.php',

composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class ComposerStaticInitText
4949
'OCA\\Text\\Exception\\InvalidSessionException' => __DIR__ . '/..' . '/../lib/Exception/InvalidSessionException.php',
5050
'OCA\\Text\\Exception\\UploadException' => __DIR__ . '/..' . '/../lib/Exception/UploadException.php',
5151
'OCA\\Text\\Exception\\VersionMismatchException' => __DIR__ . '/..' . '/../lib/Exception/VersionMismatchException.php',
52+
'OCA\\Text\\Listeners\\AddMissingIndicesListener' => __DIR__ . '/..' . '/../lib/Listeners/AddMissingIndicesListener.php',
5253
'OCA\\Text\\Listeners\\BeforeNodeDeletedListener' => __DIR__ . '/..' . '/../lib/Listeners/BeforeNodeDeletedListener.php',
5354
'OCA\\Text\\Listeners\\BeforeNodeRenamedListener' => __DIR__ . '/..' . '/../lib/Listeners/BeforeNodeRenamedListener.php',
5455
'OCA\\Text\\Listeners\\FilesLoadAdditionalScriptsListener' => __DIR__ . '/..' . '/../lib/Listeners/FilesLoadAdditionalScriptsListener.php',

lib/AppInfo/Application.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use OCA\Files\Event\LoadAdditionalScriptsEvent;
2929
use OCA\Files_Sharing\Event\BeforeTemplateRenderedEvent;
3030
use OCA\Text\Event\LoadEditor;
31+
use OCA\Text\Listeners\AddMissingIndicesListener;
3132
use OCA\Text\Listeners\BeforeNodeDeletedListener;
3233
use OCA\Text\Listeners\BeforeNodeRenamedListener;
3334
use OCA\Text\Listeners\FilesLoadAdditionalScriptsListener;
@@ -44,6 +45,7 @@
4445
use OCP\AppFramework\Bootstrap\IBootContext;
4546
use OCP\AppFramework\Bootstrap\IBootstrap;
4647
use OCP\AppFramework\Bootstrap\IRegistrationContext;
48+
use OCP\DB\Events\AddMissingIndicesEvent;
4749
use OCP\DirectEditing\RegisterDirectEditorEvent;
4850
use OCP\Files\Events\Node\BeforeNodeDeletedEvent;
4951
use OCP\Files\Events\Node\BeforeNodeRenamedEvent;
@@ -69,6 +71,7 @@ public function register(IRegistrationContext $context): void {
6971
$context->registerEventListener(NodeCopiedEvent::class, NodeCopiedListener::class);
7072
$context->registerEventListener(BeforeNodeRenamedEvent::class, BeforeNodeRenamedListener::class);
7173
$context->registerEventListener(BeforeNodeDeletedEvent::class, BeforeNodeDeletedListener::class);
74+
$context->registerEventListener(AddMissingIndicesEvent::class, AddMissingIndicesListener::class);
7275
$context->registerNotifierService(Notifier::class);
7376
$context->registerMiddleware(SessionMiddleware::class);
7477
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* @copyright Copyright (c) 2023 Julius Härtl <jus@bitgrid.net>
6+
*
7+
* @author Julius Härtl <jus@bitgrid.net>
8+
*
9+
* @license GNU AGPL version 3 or any later version
10+
*
11+
* This program is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU Affero General Public License as
13+
* published by the Free Software Foundation, either version 3 of the
14+
* License, or (at your option) any later version.
15+
*
16+
* This program is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU Affero General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU Affero General Public License
22+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
*
24+
*/
25+
26+
namespace OCA\Text\Listeners;
27+
28+
use OCP\DB\Events\AddMissingIndicesEvent;
29+
use OCP\EventDispatcher\Event;
30+
use OCP\EventDispatcher\IEventListener;
31+
32+
/**
33+
* @template-implements IEventListener<Event|AddMissingIndicesEvent>
34+
*/
35+
class AddMissingIndicesListener implements IEventListener {
36+
public function handle(Event $event): void {
37+
if (!$event instanceof AddMissingIndicesEvent) {
38+
return;
39+
}
40+
41+
$event->addMissingIndex('text_steps', 'ts_session', ['session_id']);
42+
}
43+
}

lib/Migration/Version010000Date20190617184535.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
130130
$table->setPrimaryKey(['id']);
131131
$table->addIndex(['document_id'], 'rd_steps_did_idx');
132132
$table->addIndex(['version'], 'rd_steps_version_idx');
133+
$table->addIndex(['session_id'], 'ts_session');
133134
}
134135
return $schema;
135136
}

0 commit comments

Comments
 (0)