aboutsummaryrefslogtreecommitdiffstats
path: root/lib/files
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-07-19 16:32:43 +0200
committerRobin Appelman <icewind@owncloud.com>2013-07-19 16:32:43 +0200
commit02cdd52fb0f4e6544f6f0df2a9d4da3c944e3109 (patch)
tree18c1fc6ce71081c8cbda21991ae653f6cc3c22fc /lib/files
parenta8dfee04b88132f0be8807c53562ef4f0ad5a7fc (diff)
downloadnextcloud-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.php15
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();