Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use OCA\Activity\Data;
use OCA\Activity\FilesHooksStatic;
use OCA\Activity\GroupHelper;
use OCA\Activity\Listener\AddMissingIndicesListener;
use OCA\Activity\Listener\LoadSidebarScripts;
use OCA\Activity\Listener\SetUserDefaults;
use OCA\Activity\Listener\ShareEventListener;
Expand All @@ -29,6 +30,7 @@
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\DB\Events\AddMissingIndicesEvent;
use OCP\IConfig;
use OCP\IDateTimeFormatter;
use OCP\IDBConnection;
Expand Down Expand Up @@ -127,6 +129,7 @@ public function register(IRegistrationContext $context): void {
}, false);

$context->registerCapability(Capabilities::class);
$context->registerEventListener(AddMissingIndicesEvent::class, AddMissingIndicesListener::class);
$context->registerEventListener(LoadSidebar::class, LoadSidebarScripts::class);
$context->registerEventListener(UserDeletedEvent::class, UserDeleted::class);
$context->registerEventListener(PostLoginEvent::class, SetUserDefaults::class);
Expand Down
34 changes: 34 additions & 0 deletions lib/Listener/AddMissingIndicesListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\Activity\Listener;

use OCP\DB\Events\AddMissingIndicesEvent;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;

/**
* @template-implements IEventListener<Event|AddMissingIndicesEvent>
*/
class AddMissingIndicesListener implements IEventListener {
#[\Override]

public function handle(Event $event): void {
if (!($event instanceof AddMissingIndicesEvent)) {
return;
}

$event->replaceIndex(
'activity',
['activity_object'],
'activity_object_user',
['affecteduser', 'object_type', 'object_id', 'timestamp'],
false,
);
}
}
1 change: 1 addition & 0 deletions lib/Migration/Version2006Date20170808154933.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
// FIXME Fixed install, see Version2006Date20170808155040: $table->addIndex(['affecteduser', 'app', 'timestamp'], 'activity_filter_app');
$table->addIndex(['affecteduser', 'type', 'app', 'timestamp'], 'activity_filter');
$table->addIndex(['object_type', 'object_id'], 'activity_object');
$table->addIndex(['affecteduser', 'object_type', 'object_id', 'timestamp'], 'activity_object_user');
}

if (!$schema->hasTable('activity_mq')) {
Expand Down
Loading