diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2020-04-21 14:10:33 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2020-05-01 09:14:25 +0200 |
commit | 7b0819c5113b72c73a3a35aab7ee05f3e4ef76f4 (patch) | |
tree | a085f8a49483a481c1453a2f72a78971c288635d /lib | |
parent | cfd6f0b6fbbbb6d1597ff6dce6dfc3270af40c0f (diff) | |
download | nextcloud-server-7b0819c5113b72c73a3a35aab7ee05f3e4ef76f4.tar.gz nextcloud-server-7b0819c5113b72c73a3a35aab7ee05f3e4ef76f4.zip |
Allow specifying a default expiration date
This overrides the max expiration date.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Share20/Manager.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index feb0365e9a7..b432dc2888e 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -396,7 +396,12 @@ class Manager implements IManager { if ($fullId === null && $expirationDate === null && $this->shareApiInternalDefaultExpireDate()) { $expirationDate = new \DateTime(); $expirationDate->setTime(0,0,0); - $expirationDate->add(new \DateInterval('P'.$this->shareApiInternalDefaultExpireDays().'D')); + + $days = (int)$this->config->getAppValue('core', 'internal_defaultExpDays', $this->shareApiLinkDefaultExpireDays()); + if ($days > $this->shareApiLinkDefaultExpireDays()) { + $days = $this->shareApiLinkDefaultExpireDays(); + } + $expirationDate->add(new \DateInterval('P'.$days.'D')); } // If we enforce the expiration date check that is does not exceed @@ -468,7 +473,12 @@ class Manager implements IManager { if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) { $expirationDate = new \DateTime(); $expirationDate->setTime(0,0,0); - $expirationDate->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D')); + + $days = (int)$this->config->getAppValue('core', 'link_defaultExpDays', $this->shareApiLinkDefaultExpireDays()); + if ($days > $this->shareApiLinkDefaultExpireDays()) { + $days = $this->shareApiLinkDefaultExpireDays(); + } + $expirationDate->add(new \DateInterval('P'.$days.'D')); } // If we enforce the expiration date check that is does not exceed |