diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2017-12-27 16:44:14 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2017-12-30 05:55:44 +0100 |
commit | ad20af619fa3d71d806c12fb10b418ace9cf0f66 (patch) | |
tree | c71255f61af1322ab11557954ba11bc02dfb7831 /lib | |
parent | 89ca9cb35cb62d603370e6424c83886da00342aa (diff) | |
download | nextcloud-server-ad20af619fa3d71d806c12fb10b418ace9cf0f66.tar.gz nextcloud-server-ad20af619fa3d71d806c12fb10b418ace9cf0f66.zip |
getWebDir function
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Template/SCSSCacher.php | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php index eb3636a1897..300187cf743 100644 --- a/lib/private/Template/SCSSCacher.php +++ b/lib/private/Template/SCSSCacher.php @@ -102,21 +102,7 @@ class SCSSCacher { $fileNameCSS = $this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileNameSCSS)); $path = implode('/', $path); - $webDir = null; - - // Detect if path is within an app path - $app_paths = $this->config->getSystemValue('apps_paths'); - if (!empty($app_paths)) { - foreach ($app_paths as $app_path) { - if (strpos($path, $app_path["path"]) === 0) { - $webDir = $app_path["url"].str_replace($app_path["path"], '', $path); - break; - } - } - } - if (is_null($webDir)) { - $webDir = substr($path, strlen($this->serverRoot)); - } + $webDir = $this->getWebDir($path); try { $folder = $this->appData->getFolder($app); @@ -323,4 +309,22 @@ class SCSSCacher { $frontendController = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); return substr(md5($this->urlGenerator->getBaseUrl() . $frontendController), 0, 8) . '-' . $cssFile; } + + /** + * Prepend hashed base url to the css file + * @param string $path the css file path + * @return string the webDir + */ + private function getWebDir($path) { + // Detect if path is within an app path + $app_paths = $this->config->getSystemValue('apps_paths'); + if (!empty($app_paths)) { + foreach ($app_paths as $app_path) { + if (strpos($path, $app_path["path"]) === 0) { + return $app_path["url"].str_replace($app_path["path"], '', $path); + } + } + } + return substr($path, strlen($this->serverRoot)); + } } |