Merge pull request #19460 from owncloud/fix-postScanFile-and-make-it-available-to-utils-scanner

Fix postScanFile event and make it available to utils scanner
This commit is contained in:
Thomas Müller 2015-09-30 15:03:50 +02:00
commit acd6c9b605
2 changed files with 8 additions and 3 deletions

View file

@ -186,9 +186,9 @@ class Scanner extends BasicEmitter {
} }
if (!empty($newData)) { if (!empty($newData)) {
$data['fileid'] = $this->addToCache($file, $newData, $fileId); $data['fileid'] = $this->addToCache($file, $newData, $fileId);
$this->emit('\OC\Files\Cache\Scanner', 'postScanFile', array($file, $this->storageId));
\OC_Hook::emit('\OC\Files\Cache\Scanner', 'post_scan_file', array('path' => $file, 'storage' => $this->storageId));
} }
$this->emit('\OC\Files\Cache\Scanner', 'postScanFile', array($file, $this->storageId));
\OC_Hook::emit('\OC\Files\Cache\Scanner', 'post_scan_file', array('path' => $file, 'storage' => $this->storageId));
} else { } else {
$this->removeFromCache($file); $this->removeFromCache($file);
} }

View file

@ -99,7 +99,12 @@ class Scanner extends PublicEmitter {
$scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount, $emitter) { $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount, $emitter) {
$emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint() . $path)); $emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint() . $path));
}); });
$scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function ($path) use ($mount, $emitter) {
$emitter->emit('\OC\Files\Utils\Scanner', 'postScanFile', array($mount->getMountPoint() . $path));
});
$scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function ($path) use ($mount, $emitter) {
$emitter->emit('\OC\Files\Utils\Scanner', 'postScanFolder', array($mount->getMountPoint() . $path));
});
// propagate etag and mtimes when files are changed or removed // propagate etag and mtimes when files are changed or removed
$propagator = $this->propagator; $propagator = $this->propagator;
$propagatorListener = function ($path) use ($mount, $propagator) { $propagatorListener = function ($path) use ($mount, $propagator) {