Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions lib/SetupChecks/HasOverlyLongActivities.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\Activity\SetupChecks;

use OCA\Activity\AppInfo\Application;
use OCP\IAppConfig;
use OCP\IL10N;
use OCP\SetupCheck\ISetupCheck;
use OCP\SetupCheck\SetupResult;

class HasOverlyLongActivities implements ISetupCheck {

public function __construct(
private IAppConfig $appConfig,
private IL10N $l10n,
) {
}

#[\Override]
public function getCategory(): string {
return 'activity';
}

#[\Override]
public function getName(): string {
return $this->l10n->t('Check for overly long activities');
}

#[\Override]
public function run(): SetupResult {
$activities = $this->appConfig->getValueInt(Application::APP_ID, 'overly_long_activities', 0);
if ($activities === 0) {
return SetupResult::success($this->l10n->t('No overly long activities detected.'));
}

return SetupResult::warning($this->l10n->t('There are ' . $activities . ' that generated more than 2000 characters for their content. Please check the logs for more details.'));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return SetupResult::warning($this->l10n->t('There are ' . $activities . ' that generated more than 2000 characters for their content. Please check the logs for more details.'));
return SetupResult::warning($this->l10n->t('There are ' . $activities . ' activities that generated more than 2000 characters for their content. Please check the logs for more details.'));

}
}
Loading