nextcloud/apps/settings/lib/SetupChecks/SchedulingTableSize.php
Anna Larch 157b5cbabe fix(caldav): lower scheduling table size warning
Signed-off-by: Anna Larch <anna@nextcloud.com>
2024-06-25 15:02:42 +02:00

44 lines
1,016 B
PHP

<?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 OCP\IDBConnection;
use OCP\IL10N;
class SchedulingTableSize {
private IL10N $l10n;
private IDBConnection $connection;
public function __construct(
IL10N $l10n,
IDBConnection $connection
) {
$this->l10n = $l10n;
$this->connection = $connection;
}
public function description(): string {
return $this->l10n->t('You have more than 50 000 rows in the scheduling objects table. Please run the expensive repair jobs via occ maintenance:repair --include-expensive');
}
public function severity(): string {
return 'warning';
}
public function run(): bool {
$qb = $this->connection->getQueryBuilder();
$qb->select($qb->func()->count('id'))
->from('schedulingobjects');
$query = $qb->executeQuery();
$count = $query->fetchOne();
$query->closeCursor();
return $count <= 50000;
}
}