summaryrefslogtreecommitdiffstats
path: root/apps/settings/lib
diff options
context:
space:
mode:
authorAnna Larch <anna@nextcloud.com>2023-08-17 10:19:10 +0200
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2023-08-27 14:04:44 +0000
commitb3526ea81f39bec414eb76d78f6e1c00a279cb81 (patch)
treeaac6e164ee3a8972a1fdf08a38f73fa64fff720f /apps/settings/lib
parent897c4d403700d8668c1df2f05837953c62aa2878 (diff)
downloadnextcloud-server-b3526ea81f39bec414eb76d78f6e1c00a279cb81.tar.gz
nextcloud-server-b3526ea81f39bec414eb76d78f6e1c00a279cb81.zip
fix(CardDAV): only run upgrade sync if 1000 users or less
Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'apps/settings/lib')
-rw-r--r--apps/settings/lib/Controller/CheckSetupController.php3
-rw-r--r--apps/settings/lib/SetupChecks/NeedsSystemAddressBookSync.php46
2 files changed, 49 insertions, 0 deletions
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php
index 29ef0343399..bf8de16a2b9 100644
--- a/apps/settings/lib/Controller/CheckSetupController.php
+++ b/apps/settings/lib/Controller/CheckSetupController.php
@@ -62,6 +62,7 @@ use OC\Lock\NoopLockingProvider;
use OC\Lock\DBLockingProvider;
use OC\MemoryInfo;
use OCA\Settings\SetupChecks\CheckUserCertificates;
+use OCA\Settings\SetupChecks\NeedsSystemAddressBookSync;
use OCA\Settings\SetupChecks\LdapInvalidUuids;
use OCA\Settings\SetupChecks\LegacySSEKeyFormat;
use OCA\Settings\SetupChecks\PhpDefaultCharset;
@@ -900,6 +901,7 @@ Raw output
$checkUserCertificates = new CheckUserCertificates($this->l10n, $this->config, $this->urlGenerator);
$supportedDatabases = new SupportedDatabase($this->l10n, $this->connection);
$ldapInvalidUuids = new LdapInvalidUuids($this->appManager, $this->l10n, $this->serverContainer);
+ $needsSystemAddressBookSync = new NeedsSystemAddressBookSync($this->config, $this->l10n);
return new DataResponse(
[
@@ -955,6 +957,7 @@ Raw output
SupportedDatabase::class => ['pass' => $supportedDatabases->run(), 'description' => $supportedDatabases->description(), 'severity' => $supportedDatabases->severity()],
'temporaryDirectoryWritable' => $this->isTemporaryDirectoryWritable(),
LdapInvalidUuids::class => ['pass' => $ldapInvalidUuids->run(), 'description' => $ldapInvalidUuids->description(), 'severity' => $ldapInvalidUuids->severity()],
+ NeedsSystemAddressBookSync::class => ['pass' => $needsSystemAddressBookSync->run(), 'description' => $needsSystemAddressBookSync->description(), 'severity' => $needsSystemAddressBookSync->severity()],
]
);
}
diff --git a/apps/settings/lib/SetupChecks/NeedsSystemAddressBookSync.php b/apps/settings/lib/SetupChecks/NeedsSystemAddressBookSync.php
new file mode 100644
index 00000000000..4c7c182211f
--- /dev/null
+++ b/apps/settings/lib/SetupChecks/NeedsSystemAddressBookSync.php
@@ -0,0 +1,46 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2023 Anna Larch <anna.larch@gmx.net>
+ *
+ * @author Anna Larch <anna.larch@gmx.net>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Settings\SetupChecks;
+
+use OCP\IConfig;
+use OCP\IL10N;
+
+class NeedsSystemAddressBookSync {
+ public function __construct(private IConfig $config, private IL10N $l10n) {}
+
+ public function description(): string {
+ return $this->l10n->t('The DAV system address book sync has not run yet as your instance has more than 1000 users or because an error occured. Please run it manually by calling occ dav:sync-system-addressbook.');
+ }
+
+ public function severity(): string {
+ return 'warning';
+ }
+
+ public function run(): bool {
+ return $this->config->getAppValue('dav', 'needs_system_address_book_sync', 'no') === 'no';
+ }
+}