Skip to content

Commit 1487ddc

Browse files
authored
Merge branch 'nextcloud:master' into 56609
2 parents 4640cf3 + de381f3 commit 1487ddc

File tree

495 files changed

+2311
-1324
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

495 files changed

+2311
-1324
lines changed

apps/admin_audit/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
'OCA\\AdminAudit\\IAuditLogger' => $baseDir . '/../lib/IAuditLogger.php',
2020
'OCA\\AdminAudit\\Listener\\AppManagementEventListener' => $baseDir . '/../lib/Listener/AppManagementEventListener.php',
2121
'OCA\\AdminAudit\\Listener\\AuthEventListener' => $baseDir . '/../lib/Listener/AuthEventListener.php',
22+
'OCA\\AdminAudit\\Listener\\CacheEventListener' => $baseDir . '/../lib/Listener/CacheEventListener.php',
2223
'OCA\\AdminAudit\\Listener\\ConsoleEventListener' => $baseDir . '/../lib/Listener/ConsoleEventListener.php',
2324
'OCA\\AdminAudit\\Listener\\CriticalActionPerformedEventListener' => $baseDir . '/../lib/Listener/CriticalActionPerformedEventListener.php',
2425
'OCA\\AdminAudit\\Listener\\FileEventListener' => $baseDir . '/../lib/Listener/FileEventListener.php',

apps/admin_audit/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class ComposerStaticInitAdminAudit
3434
'OCA\\AdminAudit\\IAuditLogger' => __DIR__ . '/..' . '/../lib/IAuditLogger.php',
3535
'OCA\\AdminAudit\\Listener\\AppManagementEventListener' => __DIR__ . '/..' . '/../lib/Listener/AppManagementEventListener.php',
3636
'OCA\\AdminAudit\\Listener\\AuthEventListener' => __DIR__ . '/..' . '/../lib/Listener/AuthEventListener.php',
37+
'OCA\\AdminAudit\\Listener\\CacheEventListener' => __DIR__ . '/..' . '/../lib/Listener/CacheEventListener.php',
3738
'OCA\\AdminAudit\\Listener\\ConsoleEventListener' => __DIR__ . '/..' . '/../lib/Listener/ConsoleEventListener.php',
3839
'OCA\\AdminAudit\\Listener\\CriticalActionPerformedEventListener' => __DIR__ . '/..' . '/../lib/Listener/CriticalActionPerformedEventListener.php',
3940
'OCA\\AdminAudit\\Listener\\FileEventListener' => __DIR__ . '/..' . '/../lib/Listener/FileEventListener.php',

apps/admin_audit/lib/AppInfo/Application.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use OCA\AdminAudit\IAuditLogger;
2121
use OCA\AdminAudit\Listener\AppManagementEventListener;
2222
use OCA\AdminAudit\Listener\AuthEventListener;
23+
use OCA\AdminAudit\Listener\CacheEventListener;
2324
use OCA\AdminAudit\Listener\ConsoleEventListener;
2425
use OCA\AdminAudit\Listener\CriticalActionPerformedEventListener;
2526
use OCA\AdminAudit\Listener\FileEventListener;
@@ -40,6 +41,8 @@
4041
use OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengePassed;
4142
use OCP\Console\ConsoleEvent;
4243
use OCP\EventDispatcher\IEventDispatcher;
44+
use OCP\Files\Cache\CacheEntryInsertedEvent;
45+
use OCP\Files\Cache\CacheEntryRemovedEvent;
4346
use OCP\Files\Events\Node\BeforeNodeDeletedEvent;
4447
use OCP\Files\Events\Node\BeforeNodeReadEvent;
4548
use OCP\Files\Events\Node\NodeCopiedEvent;
@@ -123,6 +126,10 @@ public function register(IRegistrationContext $context): void {
123126

124127
// Console events
125128
$context->registerEventListener(ConsoleEvent::class, ConsoleEventListener::class);
129+
130+
// Cache events
131+
$context->registerEventListener(CacheEntryInsertedEvent::class, CacheEventListener::class);
132+
$context->registerEventListener(CacheEntryRemovedEvent::class, CacheEventListener::class);
126133
}
127134

128135
public function boot(IBootContext $context): void {
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCA\AdminAudit\Listener;
11+
12+
use OCA\AdminAudit\Actions\Action;
13+
use OCP\EventDispatcher\Event;
14+
use OCP\EventDispatcher\IEventListener;
15+
use OCP\Files\Cache\CacheEntryInsertedEvent;
16+
use OCP\Files\Cache\CacheEntryRemovedEvent;
17+
18+
/**
19+
* @template-implements IEventListener<CacheEntryInsertedEvent|CacheEntryRemovedEvent>
20+
*/
21+
class CacheEventListener extends Action implements IEventListener {
22+
public function handle(Event $event): void {
23+
if ($event instanceof CacheEntryInsertedEvent) {
24+
$this->entryInserted($event);
25+
} elseif ($event instanceof CacheEntryRemovedEvent) {
26+
$this->entryRemoved($event);
27+
}
28+
}
29+
30+
private function entryInserted(CacheEntryInsertedEvent $event): void {
31+
$this->log('Cache entry inserted for fileid "%1$d", path "%2$s" on storageid "%3$d"',
32+
[
33+
'fileid' => $event->getFileId(),
34+
'path' => $event->getPath(),
35+
'storageid' => $event->getStorageId(),
36+
],
37+
['fileid', 'path', 'storageid']
38+
);
39+
}
40+
41+
private function entryRemoved(CacheEntryRemovedEvent $event): void {
42+
$this->log('Cache entry removed for fileid "%1$d", path "%2$s" on storageid "%3$d"',
43+
[
44+
'fileid' => $event->getFileId(),
45+
'path' => $event->getPath(),
46+
'storageid' => $event->getStorageId(),
47+
],
48+
['fileid', 'path', 'storageid']
49+
);
50+
}
51+
}

apps/comments/l10n/fr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ OC.L10N.register(
1717
"Delete comment" : "Supprimer le commentaire",
1818
"Cancel edit" : "Annuler les modifications",
1919
"New comment" : "Nouveau commentaire",
20-
"Write a comment …" : "Écrire un commentaire …",
20+
"Write a comment …" : "Écrire un commentaire…",
2121
"Post comment" : "Publier le commentaire",
2222
"@ for mentions, : for emoji, / for smart picker" : "@ pour les mentions, : pour les émojis, / pour le sélecteur intelligent",
2323
"Could not reload comments" : "Impossible de recharger les commentaires",

apps/comments/l10n/fr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"Delete comment" : "Supprimer le commentaire",
1616
"Cancel edit" : "Annuler les modifications",
1717
"New comment" : "Nouveau commentaire",
18-
"Write a comment …" : "Écrire un commentaire ",
18+
"Write a comment …" : "Écrire un commentaire…",
1919
"Post comment" : "Publier le commentaire",
2020
"@ for mentions, : for emoji, / for smart picker" : "@ pour les mentions, : pour les émojis, / pour le sélecteur intelligent",
2121
"Could not reload comments" : "Impossible de recharger les commentaires",

apps/comments/lib/Activity/Provider.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
use OCP\L10N\IFactory;
1919

2020
class Provider implements IProvider {
21-
protected ?IL10N $l = null;
22-
2321
public function __construct(
2422
protected IFactory $languageFactory,
2523
protected IURLGenerator $url,
@@ -42,9 +40,9 @@ public function parse($language, IEvent $event, ?IEvent $previousEvent = null):
4240
throw new UnknownActivityException();
4341
}
4442

45-
$this->l = $this->languageFactory->get('comments', $language);
46-
4743
if ($event->getSubject() === 'add_comment_subject') {
44+
$l = $this->languageFactory->get('comments', $language);
45+
4846
$this->parseMessage($event);
4947
if ($this->activityManager->getRequirePNG()) {
5048
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.png')));
@@ -54,13 +52,13 @@ public function parse($language, IEvent $event, ?IEvent $previousEvent = null):
5452

5553
if ($this->activityManager->isFormattingFilteredObject()) {
5654
try {
57-
return $this->parseShortVersion($event);
55+
return $this->parseShortVersion($event, $l);
5856
} catch (UnknownActivityException) {
5957
// Ignore and simply use the long version...
6058
}
6159
}
6260

63-
return $this->parseLongVersion($event);
61+
return $this->parseLongVersion($event, $l);
6462
}
6563
throw new UnknownActivityException();
6664

@@ -69,15 +67,15 @@ public function parse($language, IEvent $event, ?IEvent $previousEvent = null):
6967
/**
7068
* @throws UnknownActivityException
7169
*/
72-
protected function parseShortVersion(IEvent $event): IEvent {
70+
protected function parseShortVersion(IEvent $event, IL10N $l): IEvent {
7371
$subjectParameters = $this->getSubjectParameters($event);
7472

7573
if ($event->getSubject() === 'add_comment_subject') {
7674
if ($subjectParameters['actor'] === $this->activityManager->getCurrentUserId()) {
77-
$event->setRichSubject($this->l->t('You commented'), []);
75+
$event->setRichSubject($l->t('You commented'), []);
7876
} else {
7977
$author = $this->generateUserParameter($subjectParameters['actor']);
80-
$event->setRichSubject($this->l->t('{author} commented'), [
78+
$event->setRichSubject($l->t('{author} commented'), [
8179
'author' => $author,
8280
]);
8381
}
@@ -91,24 +89,24 @@ protected function parseShortVersion(IEvent $event): IEvent {
9189
/**
9290
* @throws UnknownActivityException
9391
*/
94-
protected function parseLongVersion(IEvent $event): IEvent {
92+
protected function parseLongVersion(IEvent $event, IL10N $l): IEvent {
9593
$subjectParameters = $this->getSubjectParameters($event);
9694

9795
if ($event->getSubject() === 'add_comment_subject') {
9896
if ($subjectParameters['actor'] === $this->activityManager->getCurrentUserId()) {
99-
$event->setParsedSubject($this->l->t('You commented on %1$s', [
97+
$event->setParsedSubject($l->t('You commented on %1$s', [
10098
$subjectParameters['filePath'],
10199
]))
102-
->setRichSubject($this->l->t('You commented on {file}'), [
100+
->setRichSubject($l->t('You commented on {file}'), [
103101
'file' => $this->generateFileParameter($subjectParameters['fileId'], $subjectParameters['filePath']),
104102
]);
105103
} else {
106104
$author = $this->generateUserParameter($subjectParameters['actor']);
107-
$event->setParsedSubject($this->l->t('%1$s commented on %2$s', [
105+
$event->setParsedSubject($l->t('%1$s commented on %2$s', [
108106
$author['name'],
109107
$subjectParameters['filePath'],
110108
]))
111-
->setRichSubject($this->l->t('{author} commented on {file}'), [
109+
->setRichSubject($l->t('{author} commented on {file}'), [
112110
'author' => $author,
113111
'file' => $this->generateFileParameter($subjectParameters['fileId'], $subjectParameters['filePath']),
114112
]);

apps/comments/lib/Activity/Setting.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class Setting extends ActivitySettings {
1313
public function __construct(
14-
protected IL10N $l,
14+
protected readonly IL10N $l,
1515
) {
1616
}
1717

@@ -23,11 +23,11 @@ public function getName(): string {
2323
return $this->l->t('<strong>Comments</strong> for files');
2424
}
2525

26-
public function getGroupIdentifier() {
26+
public function getGroupIdentifier(): string {
2727
return 'files';
2828
}
2929

30-
public function getGroupName() {
30+
public function getGroupName(): string {
3131
return $this->l->t('Files');
3232
}
3333

apps/comments/lib/Listener/CommentsEntityEventListener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ public function handle(Event $event): void {
2727
return;
2828
}
2929

30+
if ($this->userId === null) {
31+
return;
32+
}
33+
3034
$event->addEntityCollection('files', function ($name): bool {
3135
$nodes = $this->rootFolder->getUserFolder($this->userId)->getById((int)$name);
3236
return !empty($nodes);

apps/comments/lib/Listener/CommentsEventListener.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public function handle(Event $event): void {
3535
}
3636

3737
$eventType = $event->getEvent();
38-
if ($eventType === CommentsEvent::EVENT_ADD
39-
) {
38+
if ($eventType === CommentsEvent::EVENT_ADD) {
4039
$this->notificationHandler($event);
4140
$this->activityHandler($event);
4241
return;

0 commit comments

Comments
 (0)