diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-03-11 08:30:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-11 08:30:58 +0100 |
commit | 1a25b2e4026d8a56b458d1f4d6c50550e5d1f7dc (patch) | |
tree | a9af2aa7c299b6ee0f7e2e5f01fee8381947b7f1 /lib | |
parent | e28dbef7a1b06149fbf847fe82a145b637ef9187 (diff) | |
parent | ac29f27b1790e12b5ce50a6953714879b8f79630 (diff) | |
download | nextcloud-server-1a25b2e4026d8a56b458d1f4d6c50550e5d1f7dc.tar.gz nextcloud-server-1a25b2e4026d8a56b458d1f4d6c50550e5d1f7dc.zip |
Merge pull request #26051 from nextcloud/backport/26048/stable21
[stable21] cache baseurl in url generator
Diffstat (limited to 'lib')
-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; } } |