Implementing a WebDAV filesystem with PHP and SabreDAV
Ignoring Temporary Files
Both Windows and OS X write temporary/hidden files used to store additional information about files (such as a thumbnails of photos, or in which direction files should be displayed in a folder).
While these can be useful when browsing files on the operating system, they can cause a bit of clutter.
SabreDAV comes with a plug-in you can easily add that will hide these files. It writes them to a temporary directory rather than your WebDAV files directory.
The name of this plug-in is
Sabre_DAV_TemporaryFileFilterPlugin. You can pass the path where temporary files should be stored as the its only argument, or you can leave this blank and it will use the system temporary directory.
The following list shows how you can use this plug-in. Just like with any other plug-in it is added using the
require_once('Sabre.autoload.php'); $path = '/var/www/dav/files'; $tree = new Sabre_DAV_ObjectTree( new Sabre_DAV_FS_Directory($path) ); $server = new Sabre_DAV_Server($tree); $server->addPlugin( new Sabre_DAV_TemporaryFileFilterPlugin() ); $server->exec();