diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2021-03-10 19:58:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-10 19:58:03 +0100 |
commit | 1efa54827cc835159a12d619abe6d6372a23a93e (patch) | |
tree | b396a56da144e3aad9f5a72a96477118acbf580e | |
parent | a6447a5c03fe558ea349d0009323b1012ae2082c (diff) | |
parent | c048f0100f1e8347a05d1c9b064ba9a74b973999 (diff) | |
download | nextcloud-server-1efa54827cc835159a12d619abe6d6372a23a93e.tar.gz nextcloud-server-1efa54827cc835159a12d619abe6d6372a23a93e.zip |
Merge pull request #26048 from nextcloud/urlgenerator-cache-base-url
cache baseurl in url generator
-rw-r--r-- | lib/private/URLGenerator.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index f0de31568f4..6c68f5d805f 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -59,6 +59,8 @@ class URLGenerator implements IURLGenerator { private $request; /** @var Router */ private $router; + /** @var null|string */ + private $baseUrl = null; public function __construct(IConfig $config, ICacheFactory $cacheFactory, @@ -269,6 +271,9 @@ class URLGenerator implements IURLGenerator { * @return string base url of the current request */ public function getBaseUrl(): string { - return $this->request->getServerProtocol() . '://' . $this->request->getServerHost() . \OC::$WEBROOT; + if ($this->baseUrl === null) { + $this->baseUrl = $this->request->getServerProtocol() . '://' . $this->request->getServerHost() . \OC::$WEBROOT; + } + return $this->baseUrl; } } |