summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2017-12-28 13:32:45 +0100
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2017-12-30 05:55:45 +0100
commit02bfc867efd992c6b5b17bcdc76316cb1c970853 (patch)
tree7dae999323a18a08c2e17c209d0bc049476e95b2 /lib
parent88b72fd027e50c4f45d2a5eb47762dae67815593 (diff)
downloadnextcloud-server-02bfc867efd992c6b5b17bcdc76316cb1c970853.tar.gz
nextcloud-server-02bfc867efd992c6b5b17bcdc76316cb1c970853.zip
Added tests for various installations types
- With root installation - Core css - App inside server root - Secondary apps directory outside server root - With an installation in a sub directory - Core css - App inside server root - Secondary apps directory outside server root Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Template/SCSSCacher.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php
index 8d1eda99ee0..ddd0131eac2 100644
--- a/lib/private/Template/SCSSCacher.php
+++ b/lib/private/Template/SCSSCacher.php
@@ -102,7 +102,7 @@ class SCSSCacher {
$fileNameCSS = $this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileNameSCSS));
$path = implode('/', $path);
- $webDir = $this->getWebDir($path, $app);
+ $webDir = $this->getWebDir($path, $app, $this->serverRoot, \OC::$WEBROOT);
try {
$folder = $this->appData->getFolder($app);
@@ -187,7 +187,7 @@ class SCSSCacher {
$scss = new Compiler();
$scss->setImportPaths([
$path,
- \OC::$SERVERROOT . '/core/css/',
+ $this->serverRoot . '/core/css/',
]);
// Continue after throw
$scss->setIgnoreErrors(true);
@@ -313,17 +313,19 @@ class SCSSCacher {
/**
* Get WebDir root
* @param string $path the css file path
- * @param string $app the app name
+ * @param string $appName the app name
+ * @param string $serverRoot the server root path
+ * @param string $webRoot the nextcloud installation root path
* @return string the webDir
*/
- private function getWebDir($path, $app) {
+ private function getWebDir($path, $appName, $serverRoot, $webRoot) {
// Detect if path is within server root AND if path is within an app path
- if ( strpos($path, $this->serverRoot) === -1 && $appWebPath = \OC_App::getAppWebPath($app) ) {
+ if ( !strpos($path, $serverRoot) && $appWebPath = \OC_App::getAppWebPath($appName) ) {
// Get the file path within the app directory
- $appDirectoryPath = explode($app, $path)[1];
+ $appDirectoryPath = explode($appName, $path)[1];
// Remove the webroot
- return str_replace(\OC::$WEBROOT, '', $appWebPath.$appDirectoryPath);
+ return str_replace($webRoot, '', $appWebPath.$appDirectoryPath);
}
- return \OC::$WEBROOT.substr($path, strlen($this->serverRoot));
+ return $webRoot.substr($path, strlen($serverRoot));
}
}