From: Robin Appelman Date: Fri, 19 Jul 2013 14:32:43 +0000 (+0200) Subject: Make Cache\Scanner an emitter X-Git-Tag: v6.0.0alpha2~429^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=02cdd52fb0f4e6544f6f0df2a9d4da3c944e3109;p=nextcloud-server.git Make Cache\Scanner an emitter --- 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();