Skip to content

Commit

Permalink
Merge branch 'rolandinus-dispatch-node-written-event'
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsejet committed Nov 16, 2024
2 parents 23dcbd5 + ff90f84 commit b5b40c1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/Exif.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use OCA\Memories\AppInfo\Application;
use OCA\Memories\Service\BinExt;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Events\Node\NodeWrittenEvent;
use OCP\Files\File;

class Exif
Expand Down Expand Up @@ -397,6 +399,14 @@ public static function setFileExif(File $file, array $data): void
$file->putContent(fopen($path, 'r')); // closes the handler
}

// Dispatch NodeWrittenEvent to trigger processing by other apps
try {
$eventDispatcher = \OCP\Server::get(IEventDispatcher::class);
$eventDispatcher->dispatchTyped(new NodeWrittenEvent($file));
} catch (\Exception) {
// Not our problem
}

// Touch the file, triggering a reprocess through the hook
$file->touch();
}
Expand Down

0 comments on commit b5b40c1

Please sign in to comment.