/** * delete non existing files from the cache */ private static function cleanFolder($path, $root = '') { if (!$root) { $view = OC_Filesystem::getView(); } else { $view = new OC_FilesystemView($root == '/' ? '' : $root); } //check for removed files, not using getFolderContent to prevent loops $parent = self::getFileId($view->getRoot() . $path); $query = OC_DB::prepare('SELECT name FROM *PREFIX*fscache WHERE parent=?'); $result = $query->execute(array($parent)); while ($row = $result->fetchRow()) { $file = $path . '/' . $row['name']; if (!$view->file_exists($file)) { if (!$root) { //filesystem hooks are only valid for the default root OC_Hook::emit('OC_Filesystem', 'post_delete', array('path' => $file)); } else { self::fileSystemWatcherDelete(array('path' => $file), $root); } } } }