Clear the folder size cache for the 'Shared' folder when a new item is shared

This commit is contained in:
Michael Gapczynski 2011-08-24 11:59:03 -04:00
parent 4028dc984a
commit 4c4b1e4c2d
1 changed files with 5 additions and 1 deletions

View File

@ -66,7 +66,8 @@ class OC_Share {
throw new Exception("This item is already shared with ".$uid);
}
// Check if the target already exists for the user, if it does append a number to the name
$target = "/".$uid."/files/Shared/".basename($source);
$sharedFolder = "/".$uid."/files/Shared";
$target = $sharedFolder."/".basename($source);
if (self::getSource($target)) {
if ($pos = strrpos($target, ".")) {
$name = substr($target, 0, $pos);
@ -87,6 +88,9 @@ class OC_Share {
$uid = $uid."@".$gid;
}
$query->execute(array($uid_owner, $uid, $source, $target, $permissions));
// Clear the folder size cache for the 'Shared' folder
$clearFolderSize = OC_DB::prepare("DELETE FROM *PREFIX*foldersize WHERE path = ?");
$clearFolderSize->execute(array($sharedFolder));
}
}
}