diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 322731d677c4aa2554e5670c5a62a57c9939bab5..192422456006ca95e67a8dc2cecf23bd76e24d97 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 * @@ -403,6 +404,21 @@ class AppManager implements IAppManager { return $appPath; } + /** + * 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 */ diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index 58b617aae459dfe7dbbcc1c978b968a2a9868971..9e47f9064d97b053ef7df1f955b28ec9ecf3c70b 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 aebd47b3a2d38012e25ab12148f5277cdeae8319..391e3f0dd641188a8eb3ad9ff8dc1a3c3abd28bd 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 * @@ -125,6 +126,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 *