mirror of
https://github.com/nextcloud/server.git
synced 2024-11-14 20:36:50 +00:00
dae7c159f7
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
44 lines
1.0 KiB
PHP
44 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
namespace OC\Repair\NC16;
|
|
|
|
use OC\Collaboration\Resources\Manager;
|
|
use OCP\Collaboration\Resources\IManager;
|
|
use OCP\IConfig;
|
|
use OCP\Migration\IOutput;
|
|
use OCP\Migration\IRepairStep;
|
|
|
|
class ClearCollectionsAccessCache implements IRepairStep {
|
|
/** @var IConfig */
|
|
private $config;
|
|
|
|
/** @var Manager */
|
|
private $manager;
|
|
|
|
public function __construct(IConfig $config, IManager $manager) {
|
|
$this->config = $config;
|
|
$this->manager = $manager;
|
|
}
|
|
|
|
public function getName(): string {
|
|
return 'Clear access cache of projects';
|
|
}
|
|
|
|
private function shouldRun(): bool {
|
|
$versionFromBeforeUpdate = $this->config->getSystemValueString('version', '0.0.0.0');
|
|
return version_compare($versionFromBeforeUpdate, '17.0.0.3', '<=');
|
|
}
|
|
|
|
public function run(IOutput $output): void {
|
|
if ($this->shouldRun()) {
|
|
$this->manager->invalidateAccessCacheForAllCollections();
|
|
}
|
|
}
|
|
}
|