aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/URLGenerator.php
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2017-06-15 12:35:16 +0200
committerJulius Härtl <jus@bitgrid.net>2017-06-15 12:46:24 +0200
commit0789adaf95d2cfea8d661812b7dd964b0611495b (patch)
tree1837c8826c3b20fa78c5e3a9d4b42202974923b2 /lib/private/URLGenerator.php
parentca3c69c8ae0fd7f0d13e87d7861c54e2950a2c09 (diff)
downloadnextcloud-server-0789adaf95d2cfea8d661812b7dd964b0611495b.tar.gz
nextcloud-server-0789adaf95d2cfea8d661812b7dd964b0611495b.zip
Make cache and scss caching depend on the baseUrl
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/URLGenerator.php')
-rw-r--r--lib/private/URLGenerator.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php
index 2387deb6100..6db675e7d77 100644
--- a/lib/private/URLGenerator.php
+++ b/lib/private/URLGenerator.php
@@ -142,7 +142,7 @@ class URLGenerator implements IURLGenerator {
* Returns the path to the image.
*/
public function imagePath($app, $image) {
- $cache = $this->cacheFactory->create('imagePath');
+ $cache = $this->cacheFactory->create('imagePath-'.md5($this->getBaseUrl()).'-');
$cacheKey = $app.'-'.$image;
if($key = $cache->get($cacheKey)) {
return $key;
@@ -223,14 +223,12 @@ class URLGenerator implements IURLGenerator {
if (\OC::$CLI && !defined('PHPUNIT_RUN')) {
return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/') . '/' . ltrim($url, '/');
}
-
// The ownCloud web root can already be prepended.
- $webRoot = substr($url, 0, strlen(\OC::$WEBROOT)) === \OC::$WEBROOT
- ? ''
- : \OC::$WEBROOT;
+ if(substr($url, 0, strlen(\OC::$WEBROOT)) === \OC::$WEBROOT) {
+ $url = substr($url, strlen(\OC::$WEBROOT));
+ }
- $request = \OC::$server->getRequest();
- return $request->getServerProtocol() . '://' . $request->getServerHost() . $webRoot . $separator . $url;
+ return $this->getBaseUrl() . $separator . $url;
}
/**
@@ -241,4 +239,12 @@ class URLGenerator implements IURLGenerator {
$theme = \OC::$server->getThemingDefaults();
return $theme->buildDocLinkToKey($key);
}
+
+ /**
+ * @return string base url of the current request
+ */
+ public function getBaseUrl() {
+ $request = \OC::$server->getRequest();
+ return $request->getServerProtocol() . '://' . $request->getServerHost() . \OC::$WEBROOT;
+ }
}