Browse Source

chore: Drop \OC_App::getAppInfo

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Christoph Wurst 1 year ago
parent
commit
e76d525a43

+ 2 - 1
apps/updatenotification/lib/Notification/Notifier.php

@@ -26,6 +26,7 @@ declare(strict_types=1);
  */
 namespace OCA\UpdateNotification\Notification;
 
+use OCP\App\IAppManager;
 use OCP\IConfig;
 use OCP\IGroupManager;
 use OCP\IURLGenerator;
@@ -200,6 +201,6 @@ class Notifier implements INotifier {
 	}
 
 	protected function getAppInfo($appId, $languageCode) {
-		return \OC_App::getAppInfo($appId, false, $languageCode);
+		return \OCP\Server::get(IAppManager::class)->getAppInfo($appId, false, $languageCode);
 	}
 }

+ 2 - 1
lib/private/AppFramework/App.php

@@ -34,6 +34,7 @@ namespace OC\AppFramework;
 use OC\AppFramework\DependencyInjection\DIContainer;
 use OC\AppFramework\Http\Dispatcher;
 use OC\AppFramework\Http\Request;
+use OCP\App\IAppManager;
 use OCP\Profiler\IProfiler;
 use OC\Profiler\RoutingDataCollector;
 use OCP\AppFramework\QueryException;
@@ -68,7 +69,7 @@ class App {
 			return $topNamespace . self::$nameSpaceCache[$appId];
 		}
 
-		$appInfo = \OC_App::getAppInfo($appId);
+		$appInfo = \OCP\Server::get(IAppManager::class)->getAppInfo($appId);
 		if (isset($appInfo['namespace'])) {
 			self::$nameSpaceCache[$appId] = trim($appInfo['namespace']);
 		} else {

+ 2 - 2
lib/private/Installer.php

@@ -114,7 +114,7 @@ class Installer {
 		}
 
 		$l = \OC::$server->getL10N('core');
-		$info = OC_App::getAppInfo($basedir.'/appinfo/info.xml', true, $l->getLanguageCode());
+		$info = \OCP\Server::get(IAppManager::class)->getAppInfo($basedir . '/appinfo/info.xml', true, $l->getLanguageCode());
 
 		if (!is_array($info)) {
 			throw new \Exception(
@@ -594,7 +594,7 @@ class Installer {
 		//run appinfo/install.php
 		self::includeAppScript("$appPath/appinfo/install.php");
 
-		$info = OC_App::getAppInfo($app);
+		$info = \OCP\Server::get(IAppManager::class)->getAppInfo($app);
 		if (is_null($info)) {
 			return false;
 		}

+ 2 - 17
lib/private/legacy/OC_App.php

@@ -394,21 +394,6 @@ class OC_App {
 		return isset($appData['version']) ? $appData['version'] : '';
 	}
 
-
-	/**
-	 * Read all app metadata from the info.xml file
-	 *
-	 * @param string $appId id of the app or the path of the info.xml file
-	 * @param bool $path
-	 * @param string $lang
-	 * @return array|null
-	 * @note all data is read from info.xml, not just pre-defined fields
-	 * @deprecated 14.0.0 use \OC::$server->getAppManager()->getAppInfo()
-	 */
-	public static function getAppInfo(string $appId, bool $path = false, string $lang = null) {
-		return \OC::$server->getAppManager()->getAppInfo($appId, $path, $lang);
-	}
-
 	/**
 	 * Returns the navigation
 	 *
@@ -609,7 +594,7 @@ class OC_App {
 
 		foreach ($installedApps as $app) {
 			if (array_search($app, $blacklist) === false) {
-				$info = OC_App::getAppInfo($app, false, $langCode);
+				$info = $appManager->getAppInfo($app, false, $langCode);
 				if (!is_array($info)) {
 					\OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', ILogger::ERROR);
 					continue;
@@ -801,7 +786,7 @@ class OC_App {
 
 		\OC::$server->getAppManager()->clearAppsCache();
 		$l = \OC::$server->getL10N('core');
-		$appData = self::getAppInfo($appId, false, $l->getLanguageCode());
+		$appData = \OCP\Server::get(\OCP\App\IAppManager::class)->getAppInfo($appId, false, $l->getLanguageCode());
 
 		$ignoreMaxApps = \OC::$server->getConfig()->getSystemValue('app_install_overwrite', []);
 		$ignoreMax = in_array($appId, $ignoreMaxApps, true);

+ 3 - 1
tests/lib/InfoXmlTest.php

@@ -21,6 +21,8 @@
 
 namespace Test;
 
+use OCP\App\IAppManager;
+
 /**
  * Class InfoXmlTest
  *
@@ -58,7 +60,7 @@ class InfoXmlTest extends TestCase {
 	 * @param string $app
 	 */
 	public function testClasses($app) {
-		$appInfo = \OC_App::getAppInfo($app);
+		$appInfo = \OCP\Server::get(IAppManager::class)->getAppInfo($app);
 		$appPath = \OC_App::getAppPath($app);
 		\OC_App::registerAutoloading($app, $appPath);