]> source.dussan.org Git - nextcloud-server.git/commitdiff
Make Cache\Scanner an emitter
authorRobin Appelman <icewind@owncloud.com>
Fri, 19 Jul 2013 14:32:43 +0000 (16:32 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Mon, 5 Aug 2013 10:01:13 +0000 (12:01 +0200)
lib/files/cache/scanner.php

index 5588861fe9046c3af4d0aa97342c10c6cc7d4256..8f88de7a3514fe5e7d8e17dd29c640f79280c1b8 100644 (file)
@@ -9,8 +9,18 @@
 namespace OC\Files\Cache;
 
 use OC\Files\Filesystem;
+use OC\Hooks\BasicEmitter;
 
-class Scanner {
+/**
+ * Class Scanner
+ *
+ * Hooks available in scope \OC\Files\Cache\Scanner:
+ *  - scanFile(string $path, string $storageId)
+ *  - scanFolder(string $path, string $storageId)
+ *
+ * @package OC\Files\Cache
+ */
+class Scanner extends BasicEmitter {
        /**
         * @var \OC\Files\Storage\Storage $storage
         */
@@ -70,6 +80,7 @@ class Scanner {
                if (!self::isPartialFile($file)
                        and !Filesystem::isFileBlacklisted($file)
                ) {
+                       $this->emit('\OC\Files\Cache\Scanner', 'scanFile', array($file, $this->storageId));
                        \OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId));
                        $data = $this->getData($file);
                        if ($data) {
@@ -133,7 +144,7 @@ class Scanner {
                if ($reuse === -1) {
                        $reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : 0;
                }
-               \OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_folder', array('path' => $path, 'storage' => $this->storageId));
+               $this->emit('\OC\Files\Cache\Scanner', 'scanFolder', array($path, $this->storageId));
                $size = 0;
                $childQueue = array();
                $existingChildren = array();