]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add post hooks for filesystem scanner
authorRobin Appelman <icewind@owncloud.com>
Thu, 7 Nov 2013 15:22:29 +0000 (16:22 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Thu, 28 Nov 2013 15:35:58 +0000 (16:35 +0100)
lib/files/cache/scanner.php

index af819c47c6187255e8f820daa0c640959a09fe49..429685ce794c269a20a2118af538b90ae180e457 100644 (file)
@@ -17,6 +17,8 @@ use OC\Hooks\BasicEmitter;
  * Hooks available in scope \OC\Files\Cache\Scanner:
  *  - scanFile(string $path, string $storageId)
  *  - scanFolder(string $path, string $storageId)
+ *  - postScanFile(string $path, string $storageId)
+ *  - postScanFolder(string $path, string $storageId)
  *
  * @package OC\Files\Cache
  */
@@ -141,6 +143,8 @@ class Scanner extends BasicEmitter {
                                }
                                if (!empty($newData)) {
                                        $this->cache->put($file, $newData);
+                                       $this->emit('\OC\Files\Cache\Scanner', 'postScanFile', array($file, $this->storageId));
+                                       \OC_Hook::emit('\OC\Files\Cache\Scanner', 'post_scan_file', array('path' => $file, 'storage' => $this->storageId));
                                }
                        } else {
                                $this->cache->remove($file);
@@ -227,6 +231,7 @@ class Scanner extends BasicEmitter {
                        }
                        $this->cache->put($path, array('size' => $size));
                }
+               $this->emit('\OC\Files\Cache\Scanner', 'postScanFolder', array($path, $this->storageId));
                return $size;
        }