diff options
author | hopleus <124590925+hopleus@users.noreply.github.com> | 2024-02-26 16:49:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-26 16:49:21 +0300 |
commit | 6fd56a955ca8b65750113612fb28c0fc0bf2b4fa (patch) | |
tree | 063e26015d3d084113bb6317d048d3869dfb2f9e /lib | |
parent | f2f2a64ad703372e44ab925e461017b678f13827 (diff) | |
parent | 00c53c9e78ffca1985b4b22314af08da10a09826 (diff) | |
download | nextcloud-server-6fd56a955ca8b65750113612fb28c0fc0bf2b4fa.tar.gz nextcloud-server-6fd56a955ca8b65750113612fb28c0fc0bf2b4fa.zip |
Merge branch 'master' into bugfix/fixed-get-filename-in-fileinfo
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/FullTextSearch/FullTextSearchManager.php | 6 | ||||
-rw-r--r-- | lib/private/Server.php | 3 | ||||
-rw-r--r-- | lib/private/Share20/Manager.php | 26 |
3 files changed, 21 insertions, 14 deletions
diff --git a/lib/private/FullTextSearch/FullTextSearchManager.php b/lib/private/FullTextSearch/FullTextSearchManager.php index acaf519209b..d4d2e740613 100644 --- a/lib/private/FullTextSearch/FullTextSearchManager.php +++ b/lib/private/FullTextSearch/FullTextSearchManager.php @@ -39,11 +39,11 @@ use OCP\FullTextSearch\Service\ISearchService; * @package OC\FullTextSearch */ class FullTextSearchManager implements IFullTextSearchManager { - private ?IProviderService $providerService; + private ?IProviderService $providerService = null; - private ?IIndexService $indexService; + private ?IIndexService $indexService = null; - private ?ISearchService $searchService; + private ?ISearchService $searchService = null; /** * @since 15.0.0 diff --git a/lib/private/Server.php b/lib/private/Server.php index 2783e6f49c0..1aedd7d06ac 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -1266,7 +1266,8 @@ class Server extends ServerContainer implements IServerContainer { $c->get(IEventDispatcher::class), $c->get(IUserSession::class), $c->get(KnownUserService::class), - $c->get(ShareDisableChecker::class) + $c->get(ShareDisableChecker::class), + $c->get(IDateTimeZone::class), ); return $manager; diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 40af8546818..53f88cf14ce 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -54,6 +54,7 @@ use OCP\Files\Mount\IMountManager; use OCP\Files\Node; use OCP\HintException; use OCP\IConfig; +use OCP\IDateTimeZone; use OCP\IGroupManager; use OCP\IL10N; use OCP\IURLGenerator; @@ -120,6 +121,7 @@ class Manager implements IManager { /** @var KnownUserService */ private $knownUserService; private ShareDisableChecker $shareDisableChecker; + private IDateTimeZone $dateTimeZone; public function __construct( LoggerInterface $logger, @@ -139,7 +141,8 @@ class Manager implements IManager { IEventDispatcher $dispatcher, IUserSession $userSession, KnownUserService $knownUserService, - ShareDisableChecker $shareDisableChecker + ShareDisableChecker $shareDisableChecker, + IDateTimeZone $dateTimeZone, ) { $this->logger = $logger; $this->config = $config; @@ -162,6 +165,7 @@ class Manager implements IManager { $this->userSession = $userSession; $this->knownUserService = $knownUserService; $this->shareDisableChecker = $shareDisableChecker; + $this->dateTimeZone = $dateTimeZone; } /** @@ -382,10 +386,10 @@ class Manager implements IManager { $expirationDate = $share->getExpirationDate(); if ($expirationDate !== null) { - //Make sure the expiration date is a date + $expirationDate->setTimezone($this->dateTimeZone->getTimeZone()); $expirationDate->setTime(0, 0, 0); - $date = new \DateTime(); + $date = new \DateTime('now', $this->dateTimeZone->getTimeZone()); $date->setTime(0, 0, 0); if ($date >= $expirationDate) { $message = $this->l->t('Expiration date is in the past'); @@ -413,9 +417,8 @@ class Manager implements IManager { $isEnforced = $this->shareApiInternalDefaultExpireDateEnforced(); } if ($fullId === null && $expirationDate === null && $defaultExpireDate) { - $expirationDate = new \DateTime(); + $expirationDate = new \DateTime('now', $this->dateTimeZone->getTimeZone()); $expirationDate->setTime(0, 0, 0); - $days = (int)$this->config->getAppValue('core', $configProp, (string)$defaultExpireDays); if ($days > $defaultExpireDays) { $days = $defaultExpireDays; @@ -429,7 +432,7 @@ class Manager implements IManager { throw new \InvalidArgumentException('Expiration date is enforced'); } - $date = new \DateTime(); + $date = new \DateTime('now', $this->dateTimeZone->getTimeZone()); $date->setTime(0, 0, 0); $date->add(new \DateInterval('P' . $defaultExpireDays . 'D')); if ($date < $expirationDate) { @@ -469,10 +472,10 @@ class Manager implements IManager { $expirationDate = $share->getExpirationDate(); if ($expirationDate !== null) { - //Make sure the expiration date is a date + $expirationDate->setTimezone($this->dateTimeZone->getTimeZone()); $expirationDate->setTime(0, 0, 0); - $date = new \DateTime(); + $date = new \DateTime('now', $this->dateTimeZone->getTimeZone()); $date->setTime(0, 0, 0); if ($date >= $expirationDate) { $message = $this->l->t('Expiration date is in the past'); @@ -489,7 +492,7 @@ class Manager implements IManager { } if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) { - $expirationDate = new \DateTime(); + $expirationDate = new \DateTime('now', $this->dateTimeZone->getTimeZone()); $expirationDate->setTime(0, 0, 0); $days = (int)$this->config->getAppValue('core', 'link_defaultExpDays', (string)$this->shareApiLinkDefaultExpireDays()); @@ -505,7 +508,7 @@ class Manager implements IManager { throw new \InvalidArgumentException('Expiration date is enforced'); } - $date = new \DateTime(); + $date = new \DateTime('now', $this->dateTimeZone->getTimeZone()); $date->setTime(0, 0, 0); $date->add(new \DateInterval('P' . $this->shareApiLinkDefaultExpireDays() . 'D')); if ($date < $expirationDate) { @@ -527,6 +530,9 @@ class Manager implements IManager { throw new \Exception($message); } + if ($expirationDate instanceof \DateTime) { + $expirationDate->setTimezone(new \DateTimeZone(date_default_timezone_get())); + } $share->setExpirationDate($expirationDate); return $share; |