diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Share20/Manager.php | 3 | ||||
-rw-r--r-- | lib/private/Share20/Share.php | 8 | ||||
-rw-r--r-- | lib/public/Share/IShare.php | 8 |
3 files changed, 17 insertions, 2 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 2a2c64cf383..2e8e6f9a3af 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1313,8 +1313,7 @@ class Manager implements IManager { } protected function checkExpireDate($share) { - if ($share->getExpirationDate() !== null && - $share->getExpirationDate() <= new \DateTime()) { + if ($share->isExpired()) { $this->deleteShare($share); throw new ShareNotFound($this->l->t('The requested share does not exist anymore')); } diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php index f9b548c1adf..9ce88b5af22 100644 --- a/lib/private/Share20/Share.php +++ b/lib/private/Share20/Share.php @@ -371,6 +371,14 @@ class Share implements \OCP\Share\IShare { /** * @inheritdoc */ + public function isExpired() { + return $this->getExpirationDate() !== null && + $this->getExpirationDate() <= new \DateTime(); + } + + /** + * @inheritdoc + */ public function setSharedBy($sharedBy) { if (!is_string($sharedBy)) { throw new \InvalidArgumentException(); diff --git a/lib/public/Share/IShare.php b/lib/public/Share/IShare.php index 60bbe31d406..3b16fcaec0f 100644 --- a/lib/public/Share/IShare.php +++ b/lib/public/Share/IShare.php @@ -315,6 +315,14 @@ interface IShare { public function getExpirationDate(); /** + * Is the share expired ? + * + * @return boolean + * @since 18.0.0 + */ + public function isExpired(); + + /** * set a label for a share, some shares, e.g. public links can have a label * * @param string $label |