JSResourceLocator: re-use $app_path

Signed-off-by: Kyle Fazzari <kyrofa@ubuntu.com>
This commit is contained in:
Kyle Fazzari 2017-11-12 08:08:38 -08:00
parent 9c24b7be2d
commit d2a2793073
No known key found for this signature in database
GPG Key ID: A7D23FB0E778DEDF
1 changed files with 9 additions and 7 deletions

View File

@ -75,14 +75,16 @@ class JSResourceLocator extends ResourceLocator {
$app_path = \OC_App::getAppPath($app);
$app_url = \OC_App::getAppWebPath($app);
// Account for the possibility of having symlinks in app path. Doing
// this in a separate variable, because an empty argument to realpath
// gets turned into cwd, which makes it hard to see if app_path got set.
$real_app_path = realpath($app_path);
if ($app_path !== false) {
// Account for the possibility of having symlinks in app path. Only
// do this if $app_path is set, because an empty argument to realpath
// gets turned into cwd.
$app_path = realpath($app_path);
}
// missing translations files fill be ignored
if (strpos($script, 'l10n/') === 0) {
$this->appendIfExist($real_app_path, $script . '.js', $app_url);
$this->appendIfExist($app_path, $script . '.js', $app_url);
return;
}
@ -94,8 +96,8 @@ class JSResourceLocator extends ResourceLocator {
return;
}
if (!$this->cacheAndAppendCombineJsonIfExist($real_app_path, $script.'.json', $app)) {
$this->append($real_app_path, $script . '.js', $app_url);
if (!$this->cacheAndAppendCombineJsonIfExist($app_path, $script.'.json', $app)) {
$this->append($app_path, $script . '.js', $app_url);
}
}