Skip to content

Commit e76d525

Browse files
chore: Drop \OC_App::getAppInfo
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
1 parent cf6e2fa commit e76d525

File tree

5 files changed

+11
-22
lines changed

5 files changed

+11
-22
lines changed

apps/updatenotification/lib/Notification/Notifier.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727
namespace OCA\UpdateNotification\Notification;
2828

29+
use OCP\App\IAppManager;
2930
use OCP\IConfig;
3031
use OCP\IGroupManager;
3132
use OCP\IURLGenerator;
@@ -200,6 +201,6 @@ protected function getAppVersions(): array {
200201
}
201202

202203
protected function getAppInfo($appId, $languageCode) {
203-
return \OC_App::getAppInfo($appId, false, $languageCode);
204+
return \OCP\Server::get(IAppManager::class)->getAppInfo($appId, false, $languageCode);
204205
}
205206
}

lib/private/AppFramework/App.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
use OC\AppFramework\DependencyInjection\DIContainer;
3535
use OC\AppFramework\Http\Dispatcher;
3636
use OC\AppFramework\Http\Request;
37+
use OCP\App\IAppManager;
3738
use OCP\Profiler\IProfiler;
3839
use OC\Profiler\RoutingDataCollector;
3940
use OCP\AppFramework\QueryException;
@@ -68,7 +69,7 @@ public static function buildAppNamespace(string $appId, string $topNamespace = '
6869
return $topNamespace . self::$nameSpaceCache[$appId];
6970
}
7071

71-
$appInfo = \OC_App::getAppInfo($appId);
72+
$appInfo = \OCP\Server::get(IAppManager::class)->getAppInfo($appId);
7273
if (isset($appInfo['namespace'])) {
7374
self::$nameSpaceCache[$appId] = trim($appInfo['namespace']);
7475
} else {

lib/private/Installer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function installApp(string $appId, bool $forceEnable = false): string {
114114
}
115115

116116
$l = \OC::$server->getL10N('core');
117-
$info = OC_App::getAppInfo($basedir.'/appinfo/info.xml', true, $l->getLanguageCode());
117+
$info = \OCP\Server::get(IAppManager::class)->getAppInfo($basedir . '/appinfo/info.xml', true, $l->getLanguageCode());
118118

119119
if (!is_array($info)) {
120120
throw new \Exception(
@@ -594,7 +594,7 @@ public static function installShippedApp($app) {
594594
//run appinfo/install.php
595595
self::includeAppScript("$appPath/appinfo/install.php");
596596

597-
$info = OC_App::getAppInfo($app);
597+
$info = \OCP\Server::get(IAppManager::class)->getAppInfo($app);
598598
if (is_null($info)) {
599599
return false;
600600
}

lib/private/legacy/OC_App.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -394,21 +394,6 @@ public static function getAppVersionByPath(string $path): string {
394394
return isset($appData['version']) ? $appData['version'] : '';
395395
}
396396

397-
398-
/**
399-
* Read all app metadata from the info.xml file
400-
*
401-
* @param string $appId id of the app or the path of the info.xml file
402-
* @param bool $path
403-
* @param string $lang
404-
* @return array|null
405-
* @note all data is read from info.xml, not just pre-defined fields
406-
* @deprecated 14.0.0 use \OC::$server->getAppManager()->getAppInfo()
407-
*/
408-
public static function getAppInfo(string $appId, bool $path = false, string $lang = null) {
409-
return \OC::$server->getAppManager()->getAppInfo($appId, $path, $lang);
410-
}
411-
412397
/**
413398
* Returns the navigation
414399
*
@@ -609,7 +594,7 @@ public function listAllApps(): array {
609594

610595
foreach ($installedApps as $app) {
611596
if (array_search($app, $blacklist) === false) {
612-
$info = OC_App::getAppInfo($app, false, $langCode);
597+
$info = $appManager->getAppInfo($app, false, $langCode);
613598
if (!is_array($info)) {
614599
\OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', ILogger::ERROR);
615600
continue;
@@ -801,7 +786,7 @@ public static function updateApp(string $appId): bool {
801786

802787
\OC::$server->getAppManager()->clearAppsCache();
803788
$l = \OC::$server->getL10N('core');
804-
$appData = self::getAppInfo($appId, false, $l->getLanguageCode());
789+
$appData = \OCP\Server::get(\OCP\App\IAppManager::class)->getAppInfo($appId, false, $l->getLanguageCode());
805790

806791
$ignoreMaxApps = \OC::$server->getConfig()->getSystemValue('app_install_overwrite', []);
807792
$ignoreMax = in_array($appId, $ignoreMaxApps, true);

tests/lib/InfoXmlTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
namespace Test;
2323

24+
use OCP\App\IAppManager;
25+
2426
/**
2527
* Class InfoXmlTest
2628
*
@@ -58,7 +60,7 @@ public function dataApps() {
5860
* @param string $app
5961
*/
6062
public function testClasses($app) {
61-
$appInfo = \OC_App::getAppInfo($app);
63+
$appInfo = \OCP\Server::get(IAppManager::class)->getAppInfo($app);
6264
$appPath = \OC_App::getAppPath($app);
6365
\OC_App::registerAutoloading($app, $appPath);
6466

0 commit comments

Comments
 (0)