aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/AppFramework/App.php3
-rw-r--r--lib/private/Installer.php13
-rw-r--r--lib/private/Updater.php5
-rw-r--r--lib/private/legacy/OC_App.php65
4 files changed, 17 insertions, 69 deletions
diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php
index abf8a08a44b..b2f14b8dde4 100644
--- a/lib/private/AppFramework/App.php
+++ b/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 {
diff --git a/lib/private/Installer.php b/lib/private/Installer.php
index 43c3db7c3fd..9b286cc85b0 100644
--- a/lib/private/Installer.php
+++ b/lib/private/Installer.php
@@ -48,6 +48,7 @@ use OC\DB\Connection;
use OC\DB\MigrationService;
use OC_App;
use OC_Helper;
+use OCP\App\IAppManager;
use OCP\HintException;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
@@ -113,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(
@@ -164,7 +165,7 @@ class Installer {
OC_App::executeRepairSteps($appId, $info['repair-steps']['install']);
//set the installed version
- \OC::$server->getConfig()->setAppValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id'], false));
+ \OC::$server->getConfig()->setAppValue($info['id'], 'installed_version', \OCP\Server::get(IAppManager::class)->getAppVersion($info['id'], false));
\OC::$server->getConfig()->setAppValue($info['id'], 'enabled', 'no');
//set remote/public handlers
@@ -349,7 +350,7 @@ class Installer {
}
// Check if the version is lower than before
- $currentVersion = OC_App::getAppVersion($appId);
+ $currentVersion = \OCP\Server::get(IAppManager::class)->getAppVersion($appId, true);
$newVersion = (string)$xml->version;
if (version_compare($currentVersion, $newVersion) === 1) {
throw new \Exception(
@@ -423,7 +424,7 @@ class Installer {
foreach ($this->apps as $app) {
if ($app['id'] === $appId) {
- $currentVersion = OC_App::getAppVersion($appId);
+ $currentVersion = \OCP\Server::get(IAppManager::class)->getAppVersion($appId, true);
if (!isset($app['releases'][0]['version'])) {
return false;
@@ -593,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;
}
@@ -601,7 +602,7 @@ class Installer {
OC_App::executeRepairSteps($app, $info['repair-steps']['install']);
- $config->setAppValue($app, 'installed_version', OC_App::getAppVersion($app));
+ $config->setAppValue($app, 'installed_version', \OCP\Server::get(IAppManager::class)->getAppVersion($app));
if (array_key_exists('ocsid', $info)) {
$config->setAppValue($app, 'ocsid', $info['ocsid']);
}
diff --git a/lib/private/Updater.php b/lib/private/Updater.php
index 56285166322..5a14bb17507 100644
--- a/lib/private/Updater.php
+++ b/lib/private/Updater.php
@@ -40,6 +40,7 @@ declare(strict_types=1);
*/
namespace OC;
+use OCP\App\IAppManager;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\HintException;
@@ -355,9 +356,9 @@ class Updater extends BasicEmitter {
$stack = $stacks[$type];
foreach ($stack as $appId) {
if (\OC_App::shouldUpgrade($appId)) {
- $this->emit('\OC\Updater', 'appUpgradeStarted', [$appId, \OC_App::getAppVersion($appId)]);
+ $this->emit('\OC\Updater', 'appUpgradeStarted', [$appId, \OCP\Server::get(IAppManager::class)->getAppVersion($appId)]);
\OC_App::updateApp($appId);
- $this->emit('\OC\Updater', 'appUpgrade', [$appId, \OC_App::getAppVersion($appId)]);
+ $this->emit('\OC\Updater', 'appUpgrade', [$appId, \OCP\Server::get(IAppManager::class)->getAppVersion($appId)]);
}
if ($type !== $pseudoOtherType) {
// load authentication, filesystem and logging apps after
diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php
index 411f29cc19d..2d028ba30de 100644
--- a/lib/private/legacy/OC_App.php
+++ b/lib/private/legacy/OC_App.php
@@ -383,18 +383,6 @@ class OC_App {
}
/**
- * get the last version of the app from appinfo/info.xml
- *
- * @param string $appId
- * @param bool $useCache
- * @return string
- * @deprecated 14.0.0 use \OC::$server->getAppManager()->getAppVersion()
- */
- public static function getAppVersion(string $appId, bool $useCache = true): string {
- return \OC::$server->getAppManager()->getAppVersion($appId, $useCache);
- }
-
- /**
* get app's version based on it's path
*
* @param string $path
@@ -406,49 +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
- *
- * @return array
- * @deprecated 14.0.0 use \OC::$server->getNavigationManager()->getAll()
- *
- * This function returns an array containing all entries added. The
- * entries are sorted by the key 'order' ascending. Additional to the keys
- * given for each app the following keys exist:
- * - active: boolean, signals if the user is on this navigation entry
- */
- public static function getNavigation(): array {
- return OC::$server->getNavigationManager()->getAll();
- }
-
- /**
- * Returns the Settings Navigation
- *
- * @return string[]
- * @deprecated 14.0.0 use \OC::$server->getNavigationManager()->getAll('settings')
- *
- * This function returns an array containing all settings pages added. The
- * entries are sorted by the key 'order' ascending.
- */
- public static function getSettingsNavigation(): array {
- return OC::$server->getNavigationManager()->getAll('settings');
- }
-
/**
* get the id of loaded app
*
@@ -621,7 +566,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;
@@ -685,7 +630,7 @@ class OC_App {
}
}
- $info['version'] = OC_App::getAppVersion($app);
+ $info['version'] = $appManager->getAppVersion($app);
$appList[] = $info;
}
}
@@ -695,7 +640,7 @@ class OC_App {
public static function shouldUpgrade(string $app): bool {
$versions = self::getAppVersions();
- $currentVersion = OC_App::getAppVersion($app);
+ $currentVersion = \OCP\Server::get(\OCP\App\IAppManager::class)->getAppVersion($app);
if ($currentVersion && isset($versions[$app])) {
$installedVersion = $versions[$app];
if (!version_compare($currentVersion, $installedVersion, '=')) {
@@ -813,7 +758,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);
@@ -853,7 +798,7 @@ class OC_App {
self::setAppTypes($appId);
- $version = \OC_App::getAppVersion($appId);
+ $version = \OCP\Server::get(\OCP\App\IAppManager::class)->getAppVersion($appId);
\OC::$server->getConfig()->setAppValue($appId, 'installed_version', $version);
\OC::$server->get(IEventDispatcher::class)->dispatchTyped(new AppUpdateEvent($appId));