aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-09-09 12:20:27 +0200
committerGitHub <noreply@github.com>2019-09-09 12:20:27 +0200
commitb3f663b8aa0f458c3d89a94bb88716bfd7c0e892 (patch)
tree393f2f347fd206d4e299cae186f77cfc67960122 /lib
parent20e8ee171d1a2fb63e8c5413b4bad2e880ea2c12 (diff)
parent2d56664e3587214254c1fd35370b6854c0ad878b (diff)
downloadnextcloud-server-b3f663b8aa0f458c3d89a94bb88716bfd7c0e892.tar.gz
nextcloud-server-b3f663b8aa0f458c3d89a94bb88716bfd7c0e892.zip
Merge pull request #16859 from PhrozenByte/patch-1
Add IAppManager::getAppWebPath()
Diffstat (limited to 'lib')
-rw-r--r--lib/private/App/AppManager.php16
-rw-r--r--lib/private/legacy/app.php2
-rw-r--r--lib/public/App/IAppManager.php11
3 files changed, 29 insertions, 0 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index 322731d677c..19242245600 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -13,6 +13,7 @@
* @author Robin Appelman <robin@icewind.nl>
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Vincent Petry <pvince81@owncloud.com>
+ * @author Daniel Rudolf <nextcloud.com@daniel-rudolf.de>
*
* @license AGPL-3.0
*
@@ -404,6 +405,21 @@ class AppManager implements IAppManager {
}
/**
+ * Get the web path for the given app.
+ *
+ * @param string $appId
+ * @return string
+ * @throws AppPathNotFoundException if app path can't be found
+ */
+ public function getAppWebPath(string $appId): string {
+ $appWebPath = \OC_App::getAppWebPath($appId);
+ if($appWebPath === false) {
+ throw new AppPathNotFoundException('Could not find web path for ' . $appId);
+ }
+ return $appWebPath;
+ }
+
+ /**
* Clear the cached list of apps when enabling/disabling an app
*/
public function clearAppsCache() {
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php
index 58b617aae45..9e47f9064d9 100644
--- a/lib/private/legacy/app.php
+++ b/lib/private/legacy/app.php
@@ -485,6 +485,7 @@ class OC_App {
*
* @param string $appId
* @return string|false
+ * @deprecated 11.0.0 use \OC::$server->getAppManager()->getAppPath()
*/
public static function getAppPath(string $appId) {
if ($appId === null || trim($appId) === '') {
@@ -503,6 +504,7 @@ class OC_App {
*
* @param string $appId
* @return string|false
+ * @deprecated 18.0.0 use \OC::$server->getAppManager()->getAppWebPath()
*/
public static function getAppWebPath(string $appId) {
if (($dir = self::findAppInDirectories($appId)) != false) {
diff --git a/lib/public/App/IAppManager.php b/lib/public/App/IAppManager.php
index aebd47b3a2d..391e3f0dd64 100644
--- a/lib/public/App/IAppManager.php
+++ b/lib/public/App/IAppManager.php
@@ -8,6 +8,7 @@
* @author Morris Jobke <hey@morrisjobke.de>
* @author Robin Appelman <robin@icewind.nl>
* @author Thomas Müller <thomas.mueller@tmit.eu>
+ * @author Daniel Rudolf <nextcloud.com@daniel-rudolf.de>
*
* @license AGPL-3.0
*
@@ -126,6 +127,16 @@ interface IAppManager {
public function getAppPath($appId);
/**
+ * Get the web path for the given app.
+ *
+ * @param string $appId
+ * @return string
+ * @since 18.0.0
+ * @throws AppPathNotFoundException
+ */
+ public function getAppWebPath(string $appId): string;
+
+ /**
* List all apps enabled for a user
*
* @param \OCP\IUser $user