aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFerdinand Thiessen <rpm@fthiessen.de>2023-01-10 01:06:26 +0100
committerFerdinand Thiessen <rpm@fthiessen.de>2023-02-22 21:19:37 +0100
commitdbb1fa12738e4d30ed22deffa0b2dd921f96af04 (patch)
tree4151a2464c74d5898102c0cafe2f3cb837bb4f80 /lib
parent710c593d53ab077338ac90d6c73b851d2cc331dc (diff)
downloadnextcloud-server-dbb1fa12738e4d30ed22deffa0b2dd921f96af04.tar.gz
nextcloud-server-dbb1fa12738e4d30ed22deffa0b2dd921f96af04.zip
fix(OC/Template): Remove usage of deprecated functions in `JSResourceLocator`
Move from `\OC_App::getAppPath` to `IAppManager::getAppPath`. Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Template/JSResourceLocator.php30
1 files changed, 25 insertions, 5 deletions
diff --git a/lib/private/Template/JSResourceLocator.php b/lib/private/Template/JSResourceLocator.php
index 7648c7953f3..0745451bbd5 100644
--- a/lib/private/Template/JSResourceLocator.php
+++ b/lib/private/Template/JSResourceLocator.php
@@ -27,16 +27,22 @@
*/
namespace OC\Template;
+use OCP\App\AppPathNotFoundException;
use Psr\Log\LoggerInterface;
+use \OCP\App\IAppManager;
class JSResourceLocator extends ResourceLocator {
/** @var JSCombiner */
protected $jsCombiner;
- public function __construct(LoggerInterface $logger, JSCombiner $JSCombiner) {
+ /** @var IAppManager */
+ protected $appManager;
+
+ public function __construct(LoggerInterface $logger, JSCombiner $JSCombiner, IAppManager $appManager) {
parent::__construct($logger);
$this->jsCombiner = $JSCombiner;
+ $this->appManager = $appManager;
}
/**
@@ -80,14 +86,23 @@ class JSResourceLocator extends ResourceLocator {
}
$script = substr($script, strpos($script, '/') + 1);
- $app_path = \OC_App::getAppPath($app);
- $app_url = \OC_App::getAppWebPath($app);
+ $app_path = false;
+ $app_url = false;
- if ($app_path !== false) {
+ try {
+ $app_path = $this->appManager->getAppPath($app);
// 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);
+ } catch (AppPathNotFoundException) {
+ // pass
+ }
+
+ try {
+ $app_url = $this->appManager->getAppWebPath($app);
+ } catch (AppPathNotFoundException) {
+ // pass
}
// missing translations files fill be ignored
@@ -122,7 +137,12 @@ class JSResourceLocator extends ResourceLocator {
} else {
// Add all the files from the json
$files = $this->jsCombiner->getContent($root, $file);
- $app_url = \OC_App::getAppWebPath($app);
+ $app_url = null;
+ try {
+ $app_url = $this->appManager->getAppWebPath($app);
+ } catch (AppPathNotFoundException) {
+ // pass
+ }
foreach ($files as $jsFile) {
$this->append($root, $jsFile, $app_url);