diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-07-19 16:32:43 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-07-19 16:32:43 +0200 |
commit | 02cdd52fb0f4e6544f6f0df2a9d4da3c944e3109 (patch) | |
tree | 18c1fc6ce71081c8cbda21991ae653f6cc3c22fc /lib/files | |
parent | a8dfee04b88132f0be8807c53562ef4f0ad5a7fc (diff) | |
download | nextcloud-server-02cdd52fb0f4e6544f6f0df2a9d4da3c944e3109.tar.gz nextcloud-server-02cdd52fb0f4e6544f6f0df2a9d4da3c944e3109.zip |
Make Cache\Scanner an emitter
Diffstat (limited to 'lib/files')
-rw-r--r-- | lib/files/cache/scanner.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php index 9b94a24f481..bcd6032fcac 100644 --- a/lib/files/cache/scanner.php +++ b/lib/files/cache/scanner.php @@ -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 */ @@ -71,6 +81,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) { @@ -134,7 +145,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(); |