/** * attach listeners to the scanner * * @param \OC\Files\Mount\Mount $mount */ protected function attachListener($mount) { $scanner = $mount->getStorage()->getScanner(); $emitter = $this; $scanner->listen('\\OC\\Files\\Cache\\Scanner', 'scanFile', function ($path) use($mount, $emitter) { $emitter->emit('\\OC\\Files\\Utils\\Scanner', 'scanFile', array($mount->getMountPoint() . $path)); }); $scanner->listen('\\OC\\Files\\Cache\\Scanner', 'scanFolder', function ($path) use($mount, $emitter) { $emitter->emit('\\OC\\Files\\Utils\\Scanner', 'scanFolder', array($mount->getMountPoint() . $path)); }); }
/** * attach listeners to the scanner * * @param \OC\Files\Mount\Mount $mount */ protected function attachListener($mount) { $scanner = $mount->getStorage()->getScanner(); $emitter = $this; $scanner->listen('\\OC\\Files\\Cache\\Scanner', 'scanFile', function ($path) use($mount, $emitter) { $emitter->emit('\\OC\\Files\\Utils\\Scanner', 'scanFile', array($mount->getMountPoint() . $path)); }); $scanner->listen('\\OC\\Files\\Cache\\Scanner', 'scanFolder', function ($path) use($mount, $emitter) { $emitter->emit('\\OC\\Files\\Utils\\Scanner', 'scanFolder', array($mount->getMountPoint() . $path)); }); // propagate etag and mtimes when files are changed or removed $propagator = $this->propagator; $propagatorListener = function ($path) use($mount, $propagator) { $fullPath = Filesystem::normalizePath($mount->getMountPoint() . $path); $propagator->addChange($fullPath); }; $scanner->listen('\\OC\\Files\\Cache\\Scanner', 'addToCache', $propagatorListener); $scanner->listen('\\OC\\Files\\Cache\\Scanner', 'removeFromCache', $propagatorListener); }