aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-06-19 11:09:15 +0200
committerGitHub <noreply@github.com>2024-06-19 11:09:15 +0200
commit441dfd6646ed5491610f4a7d02afda08e2748fc2 (patch)
tree33332d1a920cf3f233ea1542150c4d9da33cd6bc /apps
parentab8556872e95f4e2ee909ef09af777dab891f297 (diff)
parente74f71b32e0943bacd3af5e2d37dd794fa7058e4 (diff)
downloadnextcloud-server-441dfd6646ed5491610f4a7d02afda08e2748fc2.tar.gz
nextcloud-server-441dfd6646ed5491610f4a7d02afda08e2748fc2.zip
Merge pull request #45930 from nextcloud/repair-mimetype-expensive
fix: move repair mimetype repair step to the expensive steps
Diffstat (limited to 'apps')
-rw-r--r--apps/settings/composer/composer/autoload_classmap.php1
-rw-r--r--apps/settings/composer/composer/autoload_static.php1
-rw-r--r--apps/settings/lib/AppInfo/Application.php2
-rw-r--r--apps/settings/lib/SetupChecks/MimeTypeMigrationAvailable.php44
4 files changed, 48 insertions, 0 deletions
diff --git a/apps/settings/composer/composer/autoload_classmap.php b/apps/settings/composer/composer/autoload_classmap.php
index 6bbb2978a87..488aaee264d 100644
--- a/apps/settings/composer/composer/autoload_classmap.php
+++ b/apps/settings/composer/composer/autoload_classmap.php
@@ -102,6 +102,7 @@ return array(
'OCA\\Settings\\SetupChecks\\LegacySSEKeyFormat' => $baseDir . '/../lib/SetupChecks/LegacySSEKeyFormat.php',
'OCA\\Settings\\SetupChecks\\MaintenanceWindowStart' => $baseDir . '/../lib/SetupChecks/MaintenanceWindowStart.php',
'OCA\\Settings\\SetupChecks\\MemcacheConfigured' => $baseDir . '/../lib/SetupChecks/MemcacheConfigured.php',
+ 'OCA\\Settings\\SetupChecks\\MimeTypeMigrationAvailable' => $baseDir . '/../lib/SetupChecks/MimeTypeMigrationAvailable.php',
'OCA\\Settings\\SetupChecks\\MysqlUnicodeSupport' => $baseDir . '/../lib/SetupChecks/MysqlUnicodeSupport.php',
'OCA\\Settings\\SetupChecks\\OcxProviders' => $baseDir . '/../lib/SetupChecks/OcxProviders.php',
'OCA\\Settings\\SetupChecks\\OverwriteCliUrl' => $baseDir . '/../lib/SetupChecks/OverwriteCliUrl.php',
diff --git a/apps/settings/composer/composer/autoload_static.php b/apps/settings/composer/composer/autoload_static.php
index df8f985d7ab..ac2e4645239 100644
--- a/apps/settings/composer/composer/autoload_static.php
+++ b/apps/settings/composer/composer/autoload_static.php
@@ -117,6 +117,7 @@ class ComposerStaticInitSettings
'OCA\\Settings\\SetupChecks\\LegacySSEKeyFormat' => __DIR__ . '/..' . '/../lib/SetupChecks/LegacySSEKeyFormat.php',
'OCA\\Settings\\SetupChecks\\MaintenanceWindowStart' => __DIR__ . '/..' . '/../lib/SetupChecks/MaintenanceWindowStart.php',
'OCA\\Settings\\SetupChecks\\MemcacheConfigured' => __DIR__ . '/..' . '/../lib/SetupChecks/MemcacheConfigured.php',
+ 'OCA\\Settings\\SetupChecks\\MimeTypeMigrationAvailable' => __DIR__ . '/..' . '/../lib/SetupChecks/MimeTypeMigrationAvailable.php',
'OCA\\Settings\\SetupChecks\\MysqlUnicodeSupport' => __DIR__ . '/..' . '/../lib/SetupChecks/MysqlUnicodeSupport.php',
'OCA\\Settings\\SetupChecks\\OcxProviders' => __DIR__ . '/..' . '/../lib/SetupChecks/OcxProviders.php',
'OCA\\Settings\\SetupChecks\\OverwriteCliUrl' => __DIR__ . '/..' . '/../lib/SetupChecks/OverwriteCliUrl.php',
diff --git a/apps/settings/lib/AppInfo/Application.php b/apps/settings/lib/AppInfo/Application.php
index 2a6b21f7f7d..f62555f0cdb 100644
--- a/apps/settings/lib/AppInfo/Application.php
+++ b/apps/settings/lib/AppInfo/Application.php
@@ -45,6 +45,7 @@ use OCA\Settings\SetupChecks\JavaScriptSourceMaps;
use OCA\Settings\SetupChecks\LegacySSEKeyFormat;
use OCA\Settings\SetupChecks\MaintenanceWindowStart;
use OCA\Settings\SetupChecks\MemcacheConfigured;
+use OCA\Settings\SetupChecks\MimeTypeMigrationAvailable;
use OCA\Settings\SetupChecks\MysqlUnicodeSupport;
use OCA\Settings\SetupChecks\OcxProviders;
use OCA\Settings\SetupChecks\OverwriteCliUrl;
@@ -176,6 +177,7 @@ class Application extends App implements IBootstrap {
$context->registerSetupCheck(LegacySSEKeyFormat::class);
$context->registerSetupCheck(MaintenanceWindowStart::class);
$context->registerSetupCheck(MemcacheConfigured::class);
+ $context->registerSetupCheck(MimeTypeMigrationAvailable::class);
$context->registerSetupCheck(MysqlUnicodeSupport::class);
$context->registerSetupCheck(OcxProviders::class);
$context->registerSetupCheck(OverwriteCliUrl::class);
diff --git a/apps/settings/lib/SetupChecks/MimeTypeMigrationAvailable.php b/apps/settings/lib/SetupChecks/MimeTypeMigrationAvailable.php
new file mode 100644
index 00000000000..98c8eacbfda
--- /dev/null
+++ b/apps/settings/lib/SetupChecks/MimeTypeMigrationAvailable.php
@@ -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');
+ }
+ }
+}