aboutsummaryrefslogtreecommitdiffstats
path: root/apps/admin_audit/lib/Actions/Files.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/admin_audit/lib/Actions/Files.php')
-rw-r--r--apps/admin_audit/lib/Actions/Files.php23
1 files changed, 2 insertions, 21 deletions
diff --git a/apps/admin_audit/lib/Actions/Files.php b/apps/admin_audit/lib/Actions/Files.php
index f07ed254272..7be4a7cd581 100644
--- a/apps/admin_audit/lib/Actions/Files.php
+++ b/apps/admin_audit/lib/Actions/Files.php
@@ -10,7 +10,6 @@ namespace OCA\AdminAudit\Actions;
use OC\Files\Node\NonExistingFile;
use OCP\Files\Events\Node\BeforeNodeDeletedEvent;
use OCP\Files\Events\Node\BeforeNodeReadEvent;
-use OCP\Files\Events\Node\BeforeNodeRenamedEvent;
use OCP\Files\Events\Node\NodeCopiedEvent;
use OCP\Files\Events\Node\NodeCreatedEvent;
use OCP\Files\Events\Node\NodeRenamedEvent;
@@ -26,9 +25,6 @@ use Psr\Log\LoggerInterface;
* @package OCA\AdminAudit\Actions
*/
class Files extends Action {
-
- private array $renamedNodes = [];
-
/**
* Logs file read actions
*/
@@ -55,28 +51,13 @@ class Files extends Action {
/**
* Logs rename actions of files
*/
- public function beforeRename(BeforeNodeRenamedEvent $event): void {
- try {
- $source = $event->getSource();
- $this->renamedNodes[$source->getId()] = $source;
- } catch (InvalidPathException|NotFoundException $e) {
- Server::get(LoggerInterface::class)->error(
- 'Exception thrown in file rename: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e]
- );
- return;
- }
- }
-
- /**
- * Logs rename actions of files
- */
public function afterRename(NodeRenamedEvent $event): void {
try {
$target = $event->getTarget();
- $originalSource = $this->renamedNodes[$target->getId()];
+ $source = $event->getSource();
$params = [
'newid' => $target->getId(),
- 'oldpath' => $originalSource->getPath(),
+ 'oldpath' => $source->getPath(),
'newpath' => $target->getPath(),
];
} catch (InvalidPathException|NotFoundException $e) {