Make your ownCloud app compatible with the new filecache

Robin Appelman has recently rewritten ownCloud’s filecache components, and made a variety of improvements to the filesystem handling classes. Some of the changes break compatibility with existing apps however, especially if they use the filecache directly.

I have just finished making the encryption app compatible, and here are the instructions I followed (originally posted by Robin to owncloud@kde.org):

OC_Filesystem and OC_FilesystemView have been renamed to \OC\Files\Filesystem and \OC\Files\View. For backwards compatibility they are still available under their old name for now but that will probably change in the future.

The filesystem cache is accessible with the following functions:

  • \OC\Files\Filesystem::getFileInfo($path)
  • \OC\Files\Filesystem::putFileInfo($path)
  • \OC\Files\Filesystem::getDirectoryContent($path)
  • \OC\Files\Filesystem::search($query)
  • \OC\Files\Filesystem::searchByMime($mimetype) (accepts both ‘text/plain’ and wildcard ‘text’ style mimetypes)

If you need to access the cache for files outside the user’s home directory, the same functions are available in \OC\Files\View.