-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add setup check for needed mimetype migrations
Signed-off-by: Robin Appelman <robin@icewind.nl>
- Loading branch information
1 parent
d9b37ac
commit e74f71b
Showing
9 changed files
with
140 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
apps/settings/lib/SetupChecks/MimeTypeMigrationAvailable.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
namespace OCA\Settings\SetupChecks; | ||
|
||
use OC\Repair\RepairMimeTypes; | ||
use OCP\IL10N; | ||
use OCP\L10N\IFactory; | ||
use OCP\SetupCheck\ISetupCheck; | ||
use OCP\SetupCheck\SetupResult; | ||
|
||
class MimeTypeMigrationAvailable implements ISetupCheck { | ||
private IL10N $l10n; | ||
|
||
public function __construct( | ||
IFactory $l10nFactory, | ||
private RepairMimeTypes $repairMimeTypes, | ||
) { | ||
$this->l10n = $l10nFactory->get('core'); | ||
} | ||
|
||
public function getCategory(): string { | ||
return 'system'; | ||
} | ||
|
||
public function getName(): string { | ||
return $this->l10n->t('Mimetype migrations available'); | ||
} | ||
|
||
public function run(): SetupResult { | ||
if ($this->repairMimeTypes->migrationsAvailable()) { | ||
return SetupResult::warning( | ||
$this->l10n->t('One or more mimetype migrations are available. Occasionally new mimetypes are added to better handle certain file types. Migrating the mimetypes take a long time on larger instances so this is not done automatically during upgrades. Use the command `occ maintenance:repair --include-expensive` to perform the migrations.'), | ||
); | ||
} else { | ||
return SetupResult::success('None'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
namespace OC\Migration; | ||
|
||
use OCP\Migration\IOutput; | ||
|
||
/** | ||
* Class NullOutput | ||
* | ||
* A simple IOutput that discards all output | ||
* | ||
* @package OC\Migration | ||
*/ | ||
class NullOutput implements IOutput { | ||
public function debug(string $message): void { | ||
} | ||
|
||
public function info($message): void { | ||
} | ||
|
||
public function warning($message): void { | ||
} | ||
|
||
public function startProgress($max = 0): void { | ||
} | ||
|
||
public function advance($step = 1, $description = ''): void { | ||
} | ||
|
||
public function finishProgress(): void { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters