Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display app names in user's language when upgrading. #6025

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,13 +395,13 @@ private static function printUpgradePage() {
}
}

$l10n = \OC::$server->getL10N('core');
if (!empty($incompatibleShippedApps)) {
$l = \OC::$server->getL10N('core');
$hint = $l->t('The files of the app %$1s were not replaced correctly. Make sure it is a version compatible with the server.', [implode(', ', $incompatibleShippedApps)]);
$hint = $l10n->t('The files of the app %$1s were not replaced correctly. Make sure it is a version compatible with the server.', [implode(', ', $incompatibleShippedApps)]);
throw new \OC\HintException('The files of the app ' . implode(', ', $incompatibleShippedApps) . ' were not replaced correctly. Make sure it is a version compatible with the server.', $hint);
}

$tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion));
$tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion, $l10n->getLanguageCode()));
$tmpl->assign('incompatibleAppsList', $incompatibleApps);
$tmpl->assign('productName', 'Nextcloud'); // for now
$tmpl->assign('oldTheme', $oldTheme);
Expand Down
10 changes: 6 additions & 4 deletions lib/private/App/AppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,16 @@ public function clearAppsCache() {
* Returns a list of apps that need upgrade
*
* @param string $version Nextcloud version as array of version components
* @param $l10n string User language code
* @return array list of app info from apps that need an upgrade
*
* @internal
*/
public function getAppsNeedingUpgrade($version) {
public function getAppsNeedingUpgrade($version, $l10n = null) {
$appsToUpgrade = [];
$apps = $this->getInstalledApps();
foreach ($apps as $appId) {
$appInfo = $this->getAppInfo($appId);
$appInfo = $this->getAppInfo($appId, $l10n);
$appDbVersion = $this->appConfig->getValue($appId, 'installed_version');
if ($appDbVersion
&& isset($appInfo['version'])
Expand All @@ -339,13 +340,14 @@ public function getAppsNeedingUpgrade($version) {
* Returns the app information from "appinfo/info.xml".
*
* @param string $appId app id
* @param $l10n string Language Code
*
* @return array app info
*
* @internal
*/
public function getAppInfo($appId) {
$appInfo = \OC_App::getAppInfo($appId);
public function getAppInfo($appId, $l10n = null) {
$appInfo = \OC_App::getAppInfo($appId, false, $l10n);
if (!isset($appInfo['version'])) {
// read version from separate file
$appInfo['version'] = \OC_App::getAppVersion($appId);
Expand Down
28 changes: 13 additions & 15 deletions tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,24 +162,22 @@ private function prepareProvidersWitBackupProvider() {
'twofactor_backupcodes',
]));

$this->appManager->expects($this->exactly(2))
$this->appManager->expects($this->at(1))
->method('getAppInfo')
->will($this->returnValueMap([
[
'mycustom2faapp',
['two-factor-providers' => [
->with('mycustom2faapp')
->will($this->returnValue(['two-factor-providers' => [
'\OCA\MyCustom2faApp\FakeProvider',
]
]
],
[
'twofactor_backupcodes',
['two-factor-providers' => [
'\OCA\TwoFactorBackupCodes\Provider\FakeBackupCodesProvider',
]
]
],
]));
]));

$this->appManager->expects($this->at(2))
->method('getAppInfo')
->with('twofactor_backupcodes')
->will($this->returnValue(['two-factor-providers' => [
'\OCA\TwoFactorBackupCodes\Provider\FakeBackupCodesProvider',
]
]));


$this->manager->expects($this->exactly(2))
->method('loadTwoFactorApp');
Expand Down