Skip to content
Snippets Groups Projects
Commit e6cf082f authored by Robin Appelman's avatar Robin Appelman
Browse files

emit a hooks during the filesystem scan

parent 208c6fd9
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,11 @@ class Scanner {
*/
private $storage;
/**
* @var string $storageId
*/
private $storageId;
/**
* @var \OC\Files\Cache\Cache $cache
*/
......@@ -29,6 +34,7 @@ class Scanner {
public function __construct(\OC\Files\Storage\Storage $storage) {
$this->storage = $storage;
$this->storageId = $this->storage->getId();
$this->cache = $storage->getCache();
$this->permissionsCache = $storage->getPermissionsCache();
}
......@@ -62,6 +68,7 @@ class Scanner {
* @return array with metadata of the scanned file
*/
public function scanFile($file) {
\OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId));
$data = $this->getData($file);
if ($file !== '') {
$parent = dirname($file);
......@@ -85,6 +92,7 @@ class Scanner {
* @return int the size of the scanned folder or -1 if the size is unknown at this stage
*/
public function scan($path, $recursive = self::SCAN_RECURSIVE) {
\OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_folder', array('path' => $path, 'storage' => $this->storageId));
$this->scanFile($path);
$size = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment