/** * delete non existing files from the cache */ public static function cleanFolder($path, $root = false) { if ($root === false) { $view = OC_Filesystem::getView(); } else { $view = new OC_FilesystemView($root); } $cachedContent = OC_FileCache_Cached::getFolderContent($path, $root); foreach ($cachedContent as $fileData) { $path = $fileData['path']; $file = $view->getRelativePath($path); if (!$view->file_exists($file)) { if ($root === false) { //filesystem hooks are only valid for the default root OC_Hook::emit('OC_Filesystem', 'post_delete', array('path' => $file)); } else { self::delete($file, $root); } } } }