@@ -34,43 +34,43 @@ |
||
| 34 | 34 | use Throwable; |
| 35 | 35 | |
| 36 | 36 | class CleanupOldCache implements IRepairStep { |
| 37 | - private const CACHE_FOLDERS = [ |
|
| 38 | - 'global', |
|
| 39 | - 'users', |
|
| 40 | - ]; |
|
| 37 | + private const CACHE_FOLDERS = [ |
|
| 38 | + 'global', |
|
| 39 | + 'users', |
|
| 40 | + ]; |
|
| 41 | 41 | |
| 42 | - private IAppData $appData; |
|
| 43 | - private IL10N $l10n; |
|
| 42 | + private IAppData $appData; |
|
| 43 | + private IL10N $l10n; |
|
| 44 | 44 | |
| 45 | - public function __construct( |
|
| 46 | - IAppData $appData, |
|
| 47 | - IL10N $l10n |
|
| 48 | - ) { |
|
| 49 | - $this->appData = $appData; |
|
| 50 | - $this->l10n = $l10n; |
|
| 51 | - } |
|
| 45 | + public function __construct( |
|
| 46 | + IAppData $appData, |
|
| 47 | + IL10N $l10n |
|
| 48 | + ) { |
|
| 49 | + $this->appData = $appData; |
|
| 50 | + $this->l10n = $l10n; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - public function getName(): string { |
|
| 54 | - return $this->l10n->t('Cleanup old theming cache'); |
|
| 55 | - } |
|
| 53 | + public function getName(): string { |
|
| 54 | + return $this->l10n->t('Cleanup old theming cache'); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - public function run(IOutput $output): void { |
|
| 58 | - $folders = array_filter( |
|
| 59 | - $this->appData->getDirectoryListing(), |
|
| 60 | - fn (ISimpleFolder $folder): bool => !in_array($folder->getName(), static::CACHE_FOLDERS, true), |
|
| 61 | - ); |
|
| 57 | + public function run(IOutput $output): void { |
|
| 58 | + $folders = array_filter( |
|
| 59 | + $this->appData->getDirectoryListing(), |
|
| 60 | + fn (ISimpleFolder $folder): bool => !in_array($folder->getName(), static::CACHE_FOLDERS, true), |
|
| 61 | + ); |
|
| 62 | 62 | |
| 63 | - $output->startProgress(count($folders)); |
|
| 63 | + $output->startProgress(count($folders)); |
|
| 64 | 64 | |
| 65 | - foreach ($folders as $folder) { |
|
| 66 | - try { |
|
| 67 | - $folder->delete(); |
|
| 68 | - } catch (Throwable $e) { |
|
| 69 | - $output->warning($this->l10n->t('Failed to delete folder: "%1$s", error: %2$s', [$folder->getName(), $e->getMessage()])); |
|
| 70 | - } |
|
| 71 | - $output->advance(); |
|
| 72 | - } |
|
| 65 | + foreach ($folders as $folder) { |
|
| 66 | + try { |
|
| 67 | + $folder->delete(); |
|
| 68 | + } catch (Throwable $e) { |
|
| 69 | + $output->warning($this->l10n->t('Failed to delete folder: "%1$s", error: %2$s', [$folder->getName(), $e->getMessage()])); |
|
| 70 | + } |
|
| 71 | + $output->advance(); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - $output->finishProgress(); |
|
| 75 | - } |
|
| 74 | + $output->finishProgress(); |
|
| 75 | + } |
|
| 76 | 76 | } |