[owncloud-devel] scanner and watcher

Robin Appelman robin at icewind.nl
Tue Dec 15 14:37:53 GMT 2015

On Monday, December 14, 2015 06:07:20 PM Michael Roth wrote:
> Hello everybody,
> we have some issues with the our external storage plugin. File changes
> which are made outside from OC were not detected. While debugging I
> found the watcher and scanner classes.
> The difference between the two is explained in the cache.php. But I
> could not find further documentation. May somebody can help me
> understanding the process.
> Who triggers the watcher?

The watcher gets triggered by core when a file or folder gets accessed.

> Because the external storage uses OC
> credentials a cronjob will not work in our scenario. Is it sufficient to
> connect the sync client or is it necessary to access the Webinterface to
> trigger the watcher?

You can trigger the watcher by either making a WebDAV request to the folder 
you want to check or visiting that folder in the web ui, not that this will 
only detect changes for direct childs of that folder (for performance reasons)

Currently the only way to detect all updates for a storage is to run the file 
scanner (occ files:scan ....)

If you have a custom storage backend and you have a way to quickly detect 
changes you can try doing your own update mechanism (get changed files and 
update the cache yourself) and use the login or filesystem setup hooks to 
trigger it 

 - Robin Appelman

More information about the Devel mailing list