Skip to content

Commit 1c13c34

Browse files
rullzerskjnldsv
authored andcommitted
Bump version so it is run once
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
1 parent 02d70c4 commit 1c13c34

3 files changed

Lines changed: 27 additions & 23 deletions

File tree

lib/private/Repair/ClearGeneratedAvatarCache.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,17 @@ public function getName() {
4949
/**
5050
* Check if this repair step should run
5151
*
52-
* @param Array $toVersion the version we're upgrading to
53-
* @return void
52+
* @return boolean
5453
*/
55-
private function shouldRun(Array $toVersion) {
56-
$fromVersion = $this->config->getSystemValue('version', '0.0.0.0');
57-
$fromVersionMajor = explode('.', $fromVersion)[0];
54+
private function shouldRun() {
55+
$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');
5856

59-
// Only run on major upgrade
60-
return version_compare($fromVersionMajor, $toVersion[0], '<');
57+
// was added to 15.0.0.4
58+
return version_compare($versionFromBeforeUpdate, '15.0.0.4', '<=');
6159
}
6260

63-
public function run(IOutput $output, bool $force = false) {
64-
if ($this->shouldRun(Util::getVersion()) || $force) {
61+
public function run(IOutput $output) {
62+
if ($this->shouldRun()) {
6563
try {
6664
$this->avatarManager->clearCachedAvatars();
6765
$output->info('Avatar cache cleared');

tests/lib/Repair/ClearGeneratedAvatarCacheTest.php

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,31 @@ protected function setUp() {
5252
$this->repair = new ClearGeneratedAvatarCache($this->config, $this->avatarManager);
5353
}
5454

55-
public function dataVersions() {
55+
public function shouldRunDataProvider() {
5656
return [
57-
['0.0.0.0', '15.0.1.2', true],
58-
['10.0.0.0', '10.0.1.2', false],
59-
['0.1.0', '0.0.1.2', false],
60-
['15.0.0.0', '15.0.1.2', false],
61-
['14.0.0.5', '15.0.0.2', true]
57+
['11.0.0.0', true],
58+
['15.0.0.3', true],
59+
['13.0.5.2', true],
60+
['12.0.0.0', true],
61+
['16.0.0.1', false],
62+
['15.0.0.2', true],
63+
['13.0.0.0', true],
64+
['15.0.0.5', false]
6265
];
6366
}
6467

6568
/**
66-
* @dataProvider dataVersions
69+
* @dataProvider shouldRunDataProvider
70+
*
71+
* @param string $from
72+
* @param boolean $expected
6773
*/
68-
public function testRun($fromVersion, $toVersion, $expected) {
69-
$this->config->expects($this->once())
70-
->method('getSystemValue')
71-
->with('version', '0.0.0.0')
72-
->willReturn($fromVersion);
74+
public function testShouldRun($from, $expected) {
75+
$this->config->expects($this->any())
76+
->method('getSystemValue')
77+
->with('version', '0.0.0.0')
78+
->willReturn($from);
7379

74-
$this->assertEquals($expected, $this->invokePrivate($this->repair, 'shouldRun', [explode('.', $toVersion)]));
80+
$this->assertEquals($expected, $this->invokePrivate($this->repair, 'shouldRun'));
7581
}
7682
}

version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
// between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel
3030
// when updating major/minor version number.
3131

32-
$OC_Version = array(15, 0, 0, 3);
32+
$OC_Version = array(15, 0, 0, 4);
3333

3434
// The human readable string
3535
$OC_VersionString = '15.0.0 alpha';

0 commit comments

Comments
 (0)