@@ -35,67 +35,67 @@ |
||
| 35 | 35 | use Throwable; |
| 36 | 36 | |
| 37 | 37 | class MigrateAdminConfig implements IRepairStep { |
| 38 | - private IAppData $appData; |
|
| 39 | - private IL10N $l10n; |
|
| 38 | + private IAppData $appData; |
|
| 39 | + private IL10N $l10n; |
|
| 40 | 40 | |
| 41 | - public function __construct( |
|
| 42 | - IAppData $appData, |
|
| 43 | - IL10N $l10n |
|
| 44 | - ) { |
|
| 45 | - $this->appData = $appData; |
|
| 46 | - $this->l10n = $l10n; |
|
| 47 | - } |
|
| 41 | + public function __construct( |
|
| 42 | + IAppData $appData, |
|
| 43 | + IL10N $l10n |
|
| 44 | + ) { |
|
| 45 | + $this->appData = $appData; |
|
| 46 | + $this->l10n = $l10n; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - public function getName(): string { |
|
| 50 | - return $this->l10n->t('Failed to clean up the old admin theming images folder'); |
|
| 51 | - } |
|
| 49 | + public function getName(): string { |
|
| 50 | + return $this->l10n->t('Failed to clean up the old admin theming images folder'); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - public function run(IOutput $output): void { |
|
| 54 | - $output->info('Migrating admin images'); |
|
| 55 | - $this->migrateAdminImages($output); |
|
| 56 | - $this->cleanupAdminImages($output); |
|
| 57 | - } |
|
| 53 | + public function run(IOutput $output): void { |
|
| 54 | + $output->info('Migrating admin images'); |
|
| 55 | + $this->migrateAdminImages($output); |
|
| 56 | + $this->cleanupAdminImages($output); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - private function migrateAdminImages(IOutput $output): void { |
|
| 60 | - try { |
|
| 61 | - $images = $this->appData->getFolder('images'); |
|
| 62 | - $output->info('Migrating admin images'); |
|
| 59 | + private function migrateAdminImages(IOutput $output): void { |
|
| 60 | + try { |
|
| 61 | + $images = $this->appData->getFolder('images'); |
|
| 62 | + $output->info('Migrating admin images'); |
|
| 63 | 63 | |
| 64 | - // get or init the global folder if any |
|
| 65 | - try { |
|
| 66 | - $global = $this->appData->getFolder('global'); |
|
| 67 | - } catch (NotFoundException $e) { |
|
| 68 | - $global = $this->appData->newFolder('global'); |
|
| 69 | - } |
|
| 64 | + // get or init the global folder if any |
|
| 65 | + try { |
|
| 66 | + $global = $this->appData->getFolder('global'); |
|
| 67 | + } catch (NotFoundException $e) { |
|
| 68 | + $global = $this->appData->newFolder('global'); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - // get or init the new images folder if any |
|
| 72 | - try { |
|
| 73 | - $newImages = $global->getFolder('images'); |
|
| 74 | - } catch (NotFoundException $e) { |
|
| 75 | - $newImages = $global->newFolder('images'); |
|
| 76 | - } |
|
| 71 | + // get or init the new images folder if any |
|
| 72 | + try { |
|
| 73 | + $newImages = $global->getFolder('images'); |
|
| 74 | + } catch (NotFoundException $e) { |
|
| 75 | + $newImages = $global->newFolder('images'); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - $files = $images->getDirectoryListing(); |
|
| 79 | - $output->startProgress(count($files)); |
|
| 80 | - foreach($files as $file) { |
|
| 81 | - $newImages->newFile($file->getName(), $file->getContent()); |
|
| 82 | - $output->advance(); |
|
| 83 | - } |
|
| 78 | + $files = $images->getDirectoryListing(); |
|
| 79 | + $output->startProgress(count($files)); |
|
| 80 | + foreach($files as $file) { |
|
| 81 | + $newImages->newFile($file->getName(), $file->getContent()); |
|
| 82 | + $output->advance(); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - $output->finishProgress(); |
|
| 86 | - } catch(NotFoundException $e) { |
|
| 87 | - $output->info('No admin images to migrate'); |
|
| 88 | - } |
|
| 89 | - } |
|
| 85 | + $output->finishProgress(); |
|
| 86 | + } catch(NotFoundException $e) { |
|
| 87 | + $output->info('No admin images to migrate'); |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | 91 | |
| 92 | - private function cleanupAdminImages(IOutput $output): void { |
|
| 93 | - try { |
|
| 94 | - $images = $this->appData->getFolder('images'); |
|
| 95 | - $images->delete(); |
|
| 96 | - } catch (NotFoundException $e) { |
|
| 97 | - } catch (Throwable $e) { |
|
| 98 | - $output->warning($this->l10n->t('Failed to cleanup the old admin image folder', [$e->getMessage()])); |
|
| 99 | - } |
|
| 100 | - } |
|
| 92 | + private function cleanupAdminImages(IOutput $output): void { |
|
| 93 | + try { |
|
| 94 | + $images = $this->appData->getFolder('images'); |
|
| 95 | + $images->delete(); |
|
| 96 | + } catch (NotFoundException $e) { |
|
| 97 | + } catch (Throwable $e) { |
|
| 98 | + $output->warning($this->l10n->t('Failed to cleanup the old admin image folder', [$e->getMessage()])); |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | 101 | } |
@@ -77,13 +77,13 @@ |
||
| 77 | 77 | |
| 78 | 78 | $files = $images->getDirectoryListing(); |
| 79 | 79 | $output->startProgress(count($files)); |
| 80 | - foreach($files as $file) { |
|
| 80 | + foreach ($files as $file) { |
|
| 81 | 81 | $newImages->newFile($file->getName(), $file->getContent()); |
| 82 | 82 | $output->advance(); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $output->finishProgress(); |
| 86 | - } catch(NotFoundException $e) { |
|
| 86 | + } catch (NotFoundException $e) { |
|
| 87 | 87 | $output->info('No admin images to migrate'); |
| 88 | 88 | } |
| 89 | 89 | } |