Skip to content

Commit 606241c

Browse files
committed
chore(legacy): Introduce public version ct plass and drop version methods from OC_Util
Signed-off-by: Julius Knorr <[email protected]>
1 parent 7ff9116 commit 606241c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+285
-264
lines changed

apps/settings/lib/Settings/Admin/Overview.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@
88
use OCP\AppFramework\Http\TemplateResponse;
99
use OCP\IConfig;
1010
use OCP\IL10N;
11+
use OCP\ServerVersion;
1112
use OCP\Settings\IDelegatedSettings;
1213

1314
class Overview implements IDelegatedSettings {
14-
/** @var IConfig */
15-
private $config;
16-
17-
/** @var IL10N $l */
18-
private $l;
19-
20-
public function __construct(IConfig $config, IL10N $l) {
21-
$this->config = $config;
22-
$this->l = $l;
15+
public function __construct(
16+
private ServerVersion $serverVersion,
17+
private IConfig $config,
18+
private IL10N $l,
19+
) {
2320
}
2421

2522
/**
@@ -28,6 +25,7 @@ public function __construct(IConfig $config, IL10N $l) {
2825
public function getForm() {
2926
$parameters = [
3027
'checkForWorkingWellKnownSetup' => $this->config->getSystemValue('check_for_working_wellknown_setup', true),
28+
'version' => $this->serverVersion->getHumanVersion(),
3129
];
3230

3331
return new TemplateResponse('settings', 'settings/admin/overview', $parameters, '');

apps/settings/templates/settings/admin/overview.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ class="icon-info"
5757
<div id="version" class="section">
5858
<!-- should be the last part, so Updater can follow if enabled (it has no heading therefore). -->
5959
<h2><?php p($l->t('Version'));?></h2>
60-
<p><strong><a href="<?php print_unescaped($theme->getBaseUrl()); ?>" rel="noreferrer noopener" target="_blank">Nextcloud Hub 9</a> (<?php p(OC_Util::getHumanVersion()) ?>)</strong></p>
60+
<p><strong><a href="<?php print_unescaped($theme->getBaseUrl()); ?>" rel="noreferrer noopener" target="_blank">Nextcloud Hub 9</a> (<?php p($_['version']) ?>)</strong></p>
6161
</div>

apps/theming/lib/Util.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,16 @@
1313
use OCP\Files\SimpleFS\ISimpleFile;
1414
use OCP\IConfig;
1515
use OCP\IUserSession;
16+
use OCP\ServerVersion;
1617

1718
class Util {
18-
19-
private IConfig $config;
20-
private IAppManager $appManager;
21-
private IAppData $appData;
22-
private ImageManager $imageManager;
23-
24-
public function __construct(IConfig $config, IAppManager $appManager, IAppData $appData, ImageManager $imageManager) {
25-
$this->config = $config;
26-
$this->appManager = $appManager;
27-
$this->appData = $appData;
28-
$this->imageManager = $imageManager;
19+
public function __construct(
20+
private ServerVersion $serverVersion,
21+
private IConfig $config,
22+
private IAppManager $appManager,
23+
private IAppData $appData,
24+
private ImageManager $imageManager,
25+
) {
2926
}
3027

3128
/**
@@ -311,7 +308,7 @@ public function getCacheBuster(): string {
311308
if (!is_null($user)) {
312309
$userId = $user->getUID();
313310
}
314-
$serverVersion = \OC_Util::getVersionString();
311+
$serverVersion = $this->serverVersion->getVersionString();
315312
$themingAppVersion = $this->appManager->getAppVersion('theming');
316313
$userCacheBuster = '';
317314
if ($userId) {

apps/theming/tests/CapabilitiesTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use OCP\IConfig;
1515
use OCP\IURLGenerator;
1616
use OCP\IUserSession;
17+
use OCP\ServerVersion;
1718
use PHPUnit\Framework\MockObject\MockObject;
1819
use Test\TestCase;
1920

@@ -169,7 +170,7 @@ public function testGetCapabilities($name, $url, $slogan, $color, $textColor, $l
169170
->method('getLogo')
170171
->willReturn($logo);
171172

172-
$util = new Util($this->config, $this->createMock(IAppManager::class), $this->createMock(IAppData::class), $this->createMock(ImageManager::class));
173+
$util = new Util($this->createMock(ServerVersion::class), $this->config, $this->createMock(IAppManager::class), $this->createMock(IAppData::class), $this->createMock(ImageManager::class));
173174
$this->util->expects($this->exactly(3))
174175
->method('elementColor')
175176
->with($color)

apps/theming/tests/IconBuilderTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use OCP\App\IAppManager;
1414
use OCP\Files\NotFoundException;
1515
use OCP\IConfig;
16+
use OCP\ServerVersion;
1617
use PHPUnit\Framework\Error\Warning;
1718
use Test\TestCase;
1819

@@ -41,7 +42,7 @@ protected function setUp(): void {
4142
$this->themingDefaults = $this->createMock(ThemingDefaults::class);
4243
$this->appManager = $this->createMock(IAppManager::class);
4344
$this->imageManager = $this->createMock(ImageManager::class);
44-
$this->util = new Util($this->config, $this->appManager, $this->appData, $this->imageManager);
45+
$this->util = new Util($this->createMock(ServerVersion::class), $this->config, $this->appManager, $this->appData, $this->imageManager);
4546
$this->iconBuilder = new IconBuilder($this->themingDefaults, $this->util, $this->imageManager);
4647
}
4748

apps/theming/tests/Themes/DarkHighContrastThemeTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use OCP\IL10N;
1919
use OCP\IURLGenerator;
2020
use OCP\IUserSession;
21+
use OCP\ServerVersion;
2122
use PHPUnit\Framework\MockObject\MockObject;
2223

2324
class DarkHighContrastThemeTest extends AccessibleThemeTestCase {
@@ -49,6 +50,7 @@ protected function setUp(): void {
4950
$this->appManager = $this->createMock(IAppManager::class);
5051

5152
$this->util = new Util(
53+
$this->createMock(ServerVersion::class),
5254
$this->config,
5355
$this->appManager,
5456
$this->createMock(IAppData::class),

apps/theming/tests/Themes/DarkThemeTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use OCP\IL10N;
1919
use OCP\IURLGenerator;
2020
use OCP\IUserSession;
21+
use OCP\ServerVersion;
2122
use PHPUnit\Framework\MockObject\MockObject;
2223

2324
class DarkThemeTest extends AccessibleThemeTestCase {
@@ -46,6 +47,7 @@ protected function setUp(): void {
4647
$this->appManager = $this->createMock(IAppManager::class);
4748

4849
$this->util = new Util(
50+
$this->createMock(ServerVersion::class),
4951
$this->config,
5052
$this->appManager,
5153
$this->createMock(IAppData::class),

apps/theming/tests/Themes/DefaultThemeTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use OCP\IL10N;
1919
use OCP\IURLGenerator;
2020
use OCP\IUserSession;
21+
use OCP\ServerVersion;
2122
use PHPUnit\Framework\MockObject\MockObject;
2223

2324
class DefaultThemeTest extends AccessibleThemeTestCase {
@@ -46,6 +47,7 @@ protected function setUp(): void {
4647
$this->appManager = $this->createMock(IAppManager::class);
4748

4849
$this->util = new Util(
50+
$this->createMock(ServerVersion::class),
4951
$this->config,
5052
$this->appManager,
5153
$this->createMock(IAppData::class),

apps/theming/tests/Themes/DyslexiaFontTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use OCP\IRequest;
2020
use OCP\IURLGenerator;
2121
use OCP\IUserSession;
22+
use OCP\ServerVersion;
2223
use PHPUnit\Framework\MockObject\MockObject;
2324
use Test\TestCase;
2425

@@ -49,6 +50,7 @@ protected function setUp(): void {
4950
$this->appManager = $this->createMock(IAppManager::class);
5051

5152
$util = new Util(
53+
$this->createMock(ServerVersion::class),
5254
$this->config,
5355
$this->appManager,
5456
$this->createMock(IAppData::class),

apps/theming/tests/Themes/HighContrastThemeTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use OCP\IL10N;
1919
use OCP\IURLGenerator;
2020
use OCP\IUserSession;
21+
use OCP\ServerVersion;
2122
use PHPUnit\Framework\MockObject\MockObject;
2223

2324
class HighContrastThemeTest extends AccessibleThemeTestCase {
@@ -49,6 +50,7 @@ protected function setUp(): void {
4950
$this->appManager = $this->createMock(IAppManager::class);
5051

5152
$this->util = new Util(
53+
$this->createMock(ServerVersion::class),
5254
$this->config,
5355
$this->appManager,
5456
$this->createMock(IAppData::class),

0 commit comments

Comments
 (0)