diff options
author | Robin Appelman <robin@icewind.nl> | 2019-02-18 15:47:54 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2019-02-18 16:50:41 +0100 |
commit | 092f78d7a414011c64066707ef4798927e25814c (patch) | |
tree | d65f737892b59038c349ff8e0316c421a285ae6b /lib/private/Files/Cache/Cache.php | |
parent | 49e8093e15fb0626f32002da7cf73b7789f1a7d4 (diff) | |
download | nextcloud-server-092f78d7a414011c64066707ef4798927e25814c.tar.gz nextcloud-server-092f78d7a414011c64066707ef4798927e25814c.zip |
add event for cache update
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Cache/Cache.php')
-rw-r--r-- | lib/private/Files/Cache/Cache.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 17e870bcbb4..7b42cc2aa57 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -41,6 +41,7 @@ use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use OCP\DB\QueryBuilder\IQueryBuilder; use Doctrine\DBAL\Driver\Statement; use OCP\Files\Cache\CacheInsertEvent; +use OCP\Files\Cache\CacheUpdateEvent; use OCP\Files\Cache\ICache; use OCP\Files\Cache\ICacheEntry; use \OCP\Files\IMimeTypeLoader; @@ -230,7 +231,7 @@ class Cache implements ICache { */ public function put($file, array $data) { if (($id = $this->getId($file)) > -1) { - $this->update($id, $data); + $this->update($id, $data, $file); return $id; } else { return $this->insert($file, $data); @@ -337,6 +338,11 @@ class Cache implements ICache { ') AND `fileid` = ? '; $this->connection->executeQuery($sql, $params); + $path = $this->getPathById($id); + // path can still be null if the file doesn't exist + if ($path !== null) { + $this->eventDispatcher->dispatch(CacheUpdateEvent::class, new CacheUpdateEvent($this->storage, $path, $id)); + } } /** |