Skip to content

Commit

Permalink
Update avatars on update
Browse files Browse the repository at this point in the history
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
  • Loading branch information
CarlSchwan committed Aug 31, 2022
1 parent e649002 commit 77ba09f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
20 changes: 7 additions & 13 deletions lib/private/Repair/ClearGeneratedAvatarCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,29 @@
use OCP\Migration\IRepairStep;

class ClearGeneratedAvatarCache implements IRepairStep {

/** @var AvatarManager */
protected $avatarManager;

/** @var IConfig */
private $config;
protected AvatarManager $avatarManager;
private IConfig $config;

public function __construct(IConfig $config, AvatarManager $avatarManager) {
$this->config = $config;
$this->avatarManager = $avatarManager;
}

public function getName() {
public function getName(): string {
return 'Clear every generated avatar on major updates';
}

/**
* Check if this repair step should run
*
* @return boolean
*/
private function shouldRun() {
private function shouldRun(): bool {
$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');

// was added to 15.0.0.4
return version_compare($versionFromBeforeUpdate, '15.0.0.4', '<=');
// was added to 25.0.0.8
return version_compare($versionFromBeforeUpdate, '25.0.0.8', '<=');
}

public function run(IOutput $output) {
public function run(IOutput $output): void {
if ($this->shouldRun()) {
try {
$this->avatarManager->clearCachedAvatars();
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel
// when updating major/minor version number.

$OC_Version = [25, 0, 0, 7];
$OC_Version = [25, 0, 0, 14];

// The human readable string
$OC_VersionString = '25.0.0 beta 3';
Expand Down

0 comments on commit 77ba09f

Please sign in to comment.