aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-09-30 09:08:17 +0200
committerJoas Schilling <coding@schilljs.com>2021-10-13 13:32:30 +0200
commitfd4ff58d62bf7e6cf5784aca1d58b9c85d1f0ca5 (patch)
tree275474d797fb45754195ff3d6dd6a0ebacc37b42
parente229cd3d53aed19c7f5036434b1fdd3967df1ddb (diff)
downloadnextcloud-server-fd4ff58d62bf7e6cf5784aca1d58b9c85d1f0ca5.tar.gz
nextcloud-server-fd4ff58d62bf7e6cf5784aca1d58b9c85d1f0ca5.zip
Fix translated app details
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--apps/updatenotification/lib/Controller/APIController.php34
-rw-r--r--apps/updatenotification/lib/Notification/Notifier.php6
-rw-r--r--lib/private/Installer.php6
-rw-r--r--lib/private/legacy/OC_App.php5
4 files changed, 30 insertions, 21 deletions
diff --git a/apps/updatenotification/lib/Controller/APIController.php b/apps/updatenotification/lib/Controller/APIController.php
index e2c720cdc09..f7f6e904e4b 100644
--- a/apps/updatenotification/lib/Controller/APIController.php
+++ b/apps/updatenotification/lib/Controller/APIController.php
@@ -35,6 +35,8 @@ use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\IConfig;
use OCP\IRequest;
+use OCP\IUserSession;
+use OCP\L10N\IFactory;
class APIController extends OCSController {
@@ -47,23 +49,29 @@ class APIController extends OCSController {
/** @var AppFetcher */
protected $appFetcher;
- /**
- * @param string $appName
- * @param IRequest $request
- * @param IConfig $config
- * @param IAppManager $appManager
- * @param AppFetcher $appFetcher
- */
- public function __construct($appName,
+ /** @var IFactory */
+ protected $l10nFactory;
+
+ /** @var IUserSession */
+ protected $userSession;
+
+ /** @var string */
+ protected $language;
+
+ public function __construct(string $appName,
IRequest $request,
IConfig $config,
IAppManager $appManager,
- AppFetcher $appFetcher) {
+ AppFetcher $appFetcher,
+ IFactory $l10nFactory,
+ IUserSession $userSession) {
parent::__construct($appName, $request);
$this->config = $config;
$this->appManager = $appManager;
$this->appFetcher = $appFetcher;
+ $this->l10nFactory = $l10nFactory;
+ $this->userSession = $userSession;
}
/**
@@ -98,7 +106,7 @@ class APIController extends OCSController {
$this->appFetcher->setVersion($newVersion, 'future-apps.json', false);
// Apps available on the app store for that version
- $availableApps = array_map(function (array $app) {
+ $availableApps = array_map(static function (array $app) {
return $app['id'];
}, $this->appFetcher->get());
@@ -109,6 +117,8 @@ class APIController extends OCSController {
], Http::STATUS_NOT_FOUND);
}
+ $this->language = $this->l10nFactory->getUserLanguage($this->userSession->getUser());
+
$missing = array_diff($installedApps, $availableApps);
$missing = array_map([$this, 'getAppDetails'], $missing);
sort($missing);
@@ -129,8 +139,8 @@ class APIController extends OCSController {
* @param string $appId
* @return string[]
*/
- protected function getAppDetails($appId): array {
- $app = $this->appManager->getAppInfo($appId);
+ protected function getAppDetails(string $appId): array {
+ $app = $this->appManager->getAppInfo($appId, false, $this->language);
return [
'appId' => $appId,
'appName' => $app['name'] ?? $appId,
diff --git a/apps/updatenotification/lib/Notification/Notifier.php b/apps/updatenotification/lib/Notification/Notifier.php
index c7963a04ea6..b10629950ff 100644
--- a/apps/updatenotification/lib/Notification/Notifier.php
+++ b/apps/updatenotification/lib/Notification/Notifier.php
@@ -135,7 +135,7 @@ class Notifier implements INotifier {
$notification->setLink($this->url->linkToRouteAbsolute('settings.AdminSettings.index', ['section' => 'overview']) . '#version');
}
} else {
- $appInfo = $this->getAppInfo($notification->getObjectType());
+ $appInfo = $this->getAppInfo($notification->getObjectType(), $languageCode);
$appName = ($appInfo === null) ? $notification->getObjectType() : $appInfo['name'];
if (isset($this->appVersions[$notification->getObjectType()])) {
@@ -195,7 +195,7 @@ class Notifier implements INotifier {
return \OC_App::getAppVersions();
}
- protected function getAppInfo($appId) {
- return \OC_App::getAppInfo($appId);
+ protected function getAppInfo($appId, $languageCode) {
+ return \OC_App::getAppInfo($appId, false, $languageCode);
}
}
diff --git a/lib/private/Installer.php b/lib/private/Installer.php
index 7b9706f65af..65740c32c57 100644
--- a/lib/private/Installer.php
+++ b/lib/private/Installer.php
@@ -114,9 +114,8 @@ class Installer {
}
$basedir = $app['path'].'/'.$appId;
- $info = OC_App::getAppInfo($basedir.'/appinfo/info.xml', true);
-
$l = \OC::$server->getL10N('core');
+ $info = OC_App::getAppInfo($basedir.'/appinfo/info.xml', true, $l->getLanguageCode());
if (!is_array($info)) {
throw new \Exception(
@@ -171,8 +170,7 @@ class Installer {
//run appinfo/install.php
self::includeAppScript($basedir . '/appinfo/install.php');
- $appData = OC_App::getAppInfo($appId);
- OC_App::executeRepairSteps($appId, $appData['repair-steps']['install']);
+ 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));
diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php
index 6fecddba540..a02ad2aebc9 100644
--- a/lib/private/legacy/OC_App.php
+++ b/lib/private/legacy/OC_App.php
@@ -980,13 +980,14 @@ class OC_App {
}
\OC::$server->getAppManager()->clearAppsCache();
- $appData = self::getAppInfo($appId);
+ $l = \OC::$server->getL10N('core');
+ $appData = self::getAppInfo($appId, false, $l->getLanguageCode());
$ignoreMaxApps = \OC::$server->getConfig()->getSystemValue('app_install_overwrite', []);
$ignoreMax = in_array($appId, $ignoreMaxApps, true);
\OC_App::checkAppDependencies(
\OC::$server->getConfig(),
- \OC::$server->getL10N('core'),
+ $l,
$appData,
$ignoreMax
);