diff options
-rw-r--r-- | apps/dav/lib/connector/sabre/file.php | 10 | ||||
-rw-r--r-- | apps/files_sharing/lib/activity.php | 93 | ||||
-rw-r--r-- | lib/private/helper.php | 3 | ||||
-rw-r--r-- | lib/private/share20/manager.php | 2 | ||||
-rw-r--r-- | lib/private/share20/share.php | 11 |
5 files changed, 94 insertions, 25 deletions
diff --git a/apps/dav/lib/connector/sabre/file.php b/apps/dav/lib/connector/sabre/file.php index be313a91e8c..38a1ee5f4e2 100644 --- a/apps/dav/lib/connector/sabre/file.php +++ b/apps/dav/lib/connector/sabre/file.php @@ -194,15 +194,15 @@ class File extends Node implements IFile { } } + // since we skipped the view we need to scan and emit the hooks ourselves + $storage->getUpdater()->update($internalPath); + try { $this->changeLock(ILockingProvider::LOCK_SHARED); } catch (LockedException $e) { throw new FileLocked($e->getMessage(), $e->getCode(), $e); } - // since we skipped the view we need to scan and emit the hooks ourselves - $storage->getUpdater()->update($internalPath); - if ($view) { $this->emitPostHooks($exists); } @@ -450,11 +450,11 @@ class File extends Node implements IFile { } } - $this->fileView->changeLock($targetPath, ILockingProvider::LOCK_SHARED); - // since we skipped the view we need to scan and emit the hooks ourselves $targetStorage->getUpdater()->update($targetInternalPath); + $this->fileView->changeLock($targetPath, ILockingProvider::LOCK_SHARED); + $this->emitPostHooks($exists, $targetPath); $info = $this->fileView->getFileInfo($targetPath); diff --git a/apps/files_sharing/lib/activity.php b/apps/files_sharing/lib/activity.php index 37a8113b916..721379eb78f 100644 --- a/apps/files_sharing/lib/activity.php +++ b/apps/files_sharing/lib/activity.php @@ -54,14 +54,26 @@ class Activity implements IExtension { const SUBJECT_REMOTE_SHARE_RECEIVED = 'remote_share_received'; const SUBJECT_REMOTE_SHARE_UNSHARED = 'remote_share_unshared'; - const SUBJECT_SHARED_GROUP_SELF = 'shared_group_self'; - const SUBJECT_SHARED_LINK_SELF = 'shared_link_self'; const SUBJECT_SHARED_USER_SELF = 'shared_user_self'; + const SUBJECT_RESHARED_USER_BY = 'reshared_user_by'; + const SUBJECT_UNSHARED_USER_SELF = 'unshared_user_self'; + const SUBJECT_UNSHARED_USER_BY = 'unshared_user_by'; + + const SUBJECT_SHARED_GROUP_SELF = 'shared_group_self'; const SUBJECT_RESHARED_GROUP_BY = 'reshared_group_by'; + const SUBJECT_UNSHARED_GROUP_SELF = 'unshared_group_self'; + const SUBJECT_UNSHARED_GROUP_BY = 'unshared_group_by'; + + const SUBJECT_SHARED_LINK_SELF = 'shared_link_self'; const SUBJECT_RESHARED_LINK_BY = 'reshared_link_by'; - const SUBJECT_RESHARED_USER_BY = 'reshared_user_by'; + const SUBJECT_UNSHARED_LINK_SELF = 'unshared_link_self'; + const SUBJECT_UNSHARED_LINK_BY = 'unshared_link_by'; + const SUBJECT_LINK_EXPIRED = 'link_expired'; + const SUBJECT_LINK_BY_EXPIRED = 'link_by_expired'; + const SUBJECT_SHARED_EMAIL = 'shared_with_email'; const SUBJECT_SHARED_WITH_BY = 'shared_with_by'; + const SUBJECT_UNSHARED_BY = 'unshared_by'; /** @var IFactory */ protected $languageFactory; @@ -197,20 +209,42 @@ class Activity implements IExtension { return (string) $l->t('Public shared folder %1$s was downloaded', $params); case self::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED: return (string) $l->t('Public shared file %1$s was downloaded', $params); + case self::SUBJECT_SHARED_USER_SELF: return (string) $l->t('You shared %1$s with %2$s', $params); - case self::SUBJECT_SHARED_GROUP_SELF: - return (string) $l->t('You shared %1$s with group %2$s', $params); case self::SUBJECT_RESHARED_USER_BY: return (string) $l->t('%2$s shared %1$s with %3$s', $params); + case self::SUBJECT_UNSHARED_USER_SELF: + return (string) $l->t('You removed the share of %2$s for %1$s', $params); + case self::SUBJECT_UNSHARED_USER_BY: + return (string) $l->t('%2$s removed the share of %3$s for %1$s', $params); + + case self::SUBJECT_SHARED_GROUP_SELF: + return (string) $l->t('You shared %1$s with group %2$s', $params); case self::SUBJECT_RESHARED_GROUP_BY: return (string) $l->t('%2$s shared %1$s with group %3$s', $params); + case self::SUBJECT_UNSHARED_GROUP_SELF: + return (string) $l->t('You removed the share of group %2$s for %1$s', $params); + case self::SUBJECT_UNSHARED_GROUP_BY: + return (string) $l->t('%2$s removed the share of group %3$s for %1$s', $params); + case self::SUBJECT_RESHARED_LINK_BY: return (string) $l->t('%2$s shared %1$s via link', $params); - case self::SUBJECT_SHARED_WITH_BY: - return (string) $l->t('%2$s shared %1$s with you', $params); case self::SUBJECT_SHARED_LINK_SELF: return (string) $l->t('You shared %1$s via link', $params); + case self::SUBJECT_UNSHARED_LINK_SELF: + return (string) $l->t('You removed the public link for %1$s', $params); + case self::SUBJECT_UNSHARED_LINK_BY: + return (string) $l->t('%2$s removed the public link for %1$s', $params); + case self::SUBJECT_LINK_EXPIRED: + return (string) $l->t('Your public link for %1$s expired', $params); + case self::SUBJECT_LINK_BY_EXPIRED: + return (string) $l->t('The public link of %2$s for %1$s expired', $params); + + case self::SUBJECT_SHARED_WITH_BY: + return (string) $l->t('%2$s shared %1$s with you', $params); + case self::SUBJECT_UNSHARED_BY: + return (string) $l->t('%2$s removed the share for %1$s', $params); case self::SUBJECT_SHARED_EMAIL: return (string) $l->t('You shared %1$s with %2$s', $params); } @@ -229,20 +263,40 @@ class Activity implements IExtension { case self::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED: case self::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED: return (string) $l->t('Downloaded via public link'); + case self::SUBJECT_SHARED_USER_SELF: return (string) $l->t('Shared with %2$s', $params); - case self::SUBJECT_SHARED_GROUP_SELF: - return (string) $l->t('Shared with group %2$s', $params); case self::SUBJECT_RESHARED_USER_BY: return (string) $l->t('Shared with %3$s by %2$s', $params); + case self::SUBJECT_UNSHARED_USER_SELF: + return (string) $l->t('Removed share for %2$s', $params); + case self::SUBJECT_UNSHARED_USER_BY: + return (string) $l->t('%2$s removed share for %3$s', $params); + + case self::SUBJECT_SHARED_GROUP_SELF: + return (string) $l->t('Shared with group %2$s', $params); case self::SUBJECT_RESHARED_GROUP_BY: return (string) $l->t('Shared with group %3$s by %2$s', $params); + case self::SUBJECT_UNSHARED_GROUP_SELF: + return (string) $l->t('Removed share of group %2$s', $params); + case self::SUBJECT_UNSHARED_GROUP_BY: + return (string) $l->t('%2$s removed share of group %3$s', $params); + case self::SUBJECT_RESHARED_LINK_BY: return (string) $l->t('Shared via link by %2$s', $params); - case self::SUBJECT_SHARED_WITH_BY: - return (string) $l->t('Shared by %2$s', $params); case self::SUBJECT_SHARED_LINK_SELF: return (string) $l->t('Shared via public link'); + case self::SUBJECT_UNSHARED_LINK_SELF: + return (string) $l->t('Removed public link'); + case self::SUBJECT_UNSHARED_LINK_BY: + return (string) $l->t('%2$s removed public link'); + case self::SUBJECT_LINK_EXPIRED: + return (string) $l->t('Public link expired', $params); + case self::SUBJECT_LINK_BY_EXPIRED: + return (string) $l->t('Public link of %2$s expired', $params); + + case self::SUBJECT_SHARED_WITH_BY: + return (string) $l->t('Shared by %2$s', $params); case self::SUBJECT_SHARED_EMAIL: return (string) $l->t('Shared with %2$s', $params); @@ -283,6 +337,8 @@ class Activity implements IExtension { 0 => 'file', ); case self::SUBJECT_SHARED_LINK_SELF: + case self::SUBJECT_UNSHARED_LINK_SELF: + case self::SUBJECT_LINK_EXPIRED: return [0 => 'file']; case self::SUBJECT_RESHARED_LINK_BY: return [ @@ -298,8 +354,13 @@ class Activity implements IExtension { case self::SUBJECT_SHARED_USER_SELF: case self::SUBJECT_SHARED_WITH_BY: + case self::SUBJECT_UNSHARED_BY: + case self::SUBJECT_UNSHARED_LINK_BY: + case self::SUBJECT_LINK_BY_EXPIRED: + case self::SUBJECT_UNSHARED_USER_SELF: return [0 => 'file', 1 => 'username']; case self::SUBJECT_RESHARED_USER_BY: + case self::SUBJECT_UNSHARED_USER_BY: return [ 0 => 'file', 1 => 'username', @@ -307,12 +368,14 @@ class Activity implements IExtension { ]; case self::SUBJECT_SHARED_GROUP_SELF: + case self::SUBJECT_UNSHARED_GROUP_SELF: return [ 0 => 'file', 1 => 'group', ]; case self::SUBJECT_RESHARED_GROUP_BY: + case self::SUBJECT_UNSHARED_GROUP_BY: return [ 0 => 'file', 1 => 'username', @@ -335,18 +398,16 @@ class Activity implements IExtension { if ($activity['app'] === self::FILES_SHARING_APP) { switch ($activity['subject']) { case self::SUBJECT_SHARED_LINK_SELF: + case self::SUBJECT_UNSHARED_LINK_SELF: + case self::SUBJECT_LINK_EXPIRED: case self::SUBJECT_SHARED_WITH_BY: + case self::SUBJECT_UNSHARED_BY: // Group by file name return 0; case self::SUBJECT_SHARED_USER_SELF: case self::SUBJECT_SHARED_GROUP_SELF: // Group by user/group return 1; - case self::SUBJECT_RESHARED_USER_BY: - case self::SUBJECT_RESHARED_GROUP_BY: - // Group by user/group - // FIXME: Grouping does currently not work with more then 2 parameters - // return 2; } } diff --git a/lib/private/helper.php b/lib/private/helper.php index 495f95e72d2..23068330f81 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -583,7 +583,8 @@ class OC_Helper { } } } - $memcache->set($program, $result, 3600); + // store the value for 5 minutes + $memcache->set($program, $result, 300); return $result; } diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php index c13bf965676..4345784d2e7 100644 --- a/lib/private/share20/manager.php +++ b/lib/private/share20/manager.php @@ -720,7 +720,7 @@ class Manager implements IManager { 'itemSource' => $share->getNodeId(), 'shareType' => $shareType, 'shareWith' => $sharedWith, - 'itemparent' => $share->getParent(), + 'itemparent' => method_exists($share, 'getParent') ? $share->getParent() : '', 'uidOwner' => $share->getSharedBy(), 'fileSource' => $share->getNodeId(), 'fileTarget' => $share->getTarget() diff --git a/lib/private/share20/share.php b/lib/private/share20/share.php index 323d8c8e8ab..6edd0e6886a 100644 --- a/lib/private/share20/share.php +++ b/lib/private/share20/share.php @@ -321,7 +321,11 @@ class Share implements \OCP\Share\IShare { } /** - * @inheritdoc + * Set the parent of this share + * + * @param int parent + * @return \OCP\Share\IShare + * @deprecated The new shares do not have parents. This is just here for legacy reasons. */ public function setParent($parent) { $this->parent = $parent; @@ -329,7 +333,10 @@ class Share implements \OCP\Share\IShare { } /** - * @inheritdoc + * Get the parent of this share. + * + * @return int + * @deprecated The new shares do not have parents. This is just here for legacy reasons. */ public function getParent() { return $this->parent; |