. */ namespace OC\Files\Cache; class Shared_Updater { /** * Correct the parent folders' ETags for all users shared the file at $target * * @param string $target */ static public function correctFolders($target) { $uid = \OCP\User::getUser(); $uidOwner = \OC\Files\Filesystem::getOwner($target); $info = \OC\Files\Filesystem::getFileInfo($target); // Correct Shared folders of other users shared with $users = \OCP\Share::getUsersItemShared('file', $info['fileid'], $uidOwner, true); if (!empty($users)) { foreach ($users as $user) { // The ETag of the logged in user should already be updated if ($user !== $uid) { $etag = \OC\Files\Filesystem::getETag(''); \OCP\Config::setUserValue($user, 'files_sharing', 'etag', $etag); } } // Correct folders of shared file owner if ($uidOwner !== $uid && $source = \OC_Share_Backend_File::getSource($target)) { \OC\Files\Filesystem::initMountPoints($source['uid_owner']); $source = '/'.$source['uid_owner'].'/'.$source['path']; $mtime = \OC\Files\Filesystem::filemtime($target); \OC\Files\Cache\Updater::correctFolder($source, $mtime); } } } /** * @param array $params */ static public function writeHook($params) { self::correctFolders($params['path']); } /** * @param array $params */ static public function renameHook($params) { self::correctFolders($params['oldpath']); self::correctFolders($params['newpath']); } /** * @param array $params */ static public function deleteHook($params) { self::correctFolders($params['path']); } }