mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
Rename to "Push service" and enable on all instances to avoid trouble
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
67541f21f6
commit
3be505f9c2
4 changed files with 16 additions and 10 deletions
|
|
@ -88,7 +88,6 @@ return array(
|
|||
'OCA\\Settings\\SetupChecks\\DatabasePendingBigIntConversions' => $baseDir . '/../lib/SetupChecks/DatabasePendingBigIntConversions.php',
|
||||
'OCA\\Settings\\SetupChecks\\DefaultPhoneRegionSet' => $baseDir . '/../lib/SetupChecks/DefaultPhoneRegionSet.php',
|
||||
'OCA\\Settings\\SetupChecks\\EmailTestSuccessful' => $baseDir . '/../lib/SetupChecks/EmailTestSuccessful.php',
|
||||
'OCA\\Settings\\SetupChecks\\FairUseOfFreePushService' => $baseDir . '/../lib/SetupChecks/FairUseOfFreePushService.php',
|
||||
'OCA\\Settings\\SetupChecks\\FileLocking' => $baseDir . '/../lib/SetupChecks/FileLocking.php',
|
||||
'OCA\\Settings\\SetupChecks\\ForwardedForHeaders' => $baseDir . '/../lib/SetupChecks/ForwardedForHeaders.php',
|
||||
'OCA\\Settings\\SetupChecks\\InternetConnectivity' => $baseDir . '/../lib/SetupChecks/InternetConnectivity.php',
|
||||
|
|
@ -107,6 +106,7 @@ return array(
|
|||
'OCA\\Settings\\SetupChecks\\PhpOpcacheSetup' => $baseDir . '/../lib/SetupChecks/PhpOpcacheSetup.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpOutdated' => $baseDir . '/../lib/SetupChecks/PhpOutdated.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpOutputBuffering' => $baseDir . '/../lib/SetupChecks/PhpOutputBuffering.php',
|
||||
'OCA\\Settings\\SetupChecks\\PushService' => $baseDir . '/../lib/SetupChecks/PushService.php',
|
||||
'OCA\\Settings\\SetupChecks\\RandomnessSecure' => $baseDir . '/../lib/SetupChecks/RandomnessSecure.php',
|
||||
'OCA\\Settings\\SetupChecks\\ReadOnlyConfig' => $baseDir . '/../lib/SetupChecks/ReadOnlyConfig.php',
|
||||
'OCA\\Settings\\SetupChecks\\SupportedDatabase' => $baseDir . '/../lib/SetupChecks/SupportedDatabase.php',
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@ class ComposerStaticInitSettings
|
|||
'OCA\\Settings\\SetupChecks\\DatabasePendingBigIntConversions' => __DIR__ . '/..' . '/../lib/SetupChecks/DatabasePendingBigIntConversions.php',
|
||||
'OCA\\Settings\\SetupChecks\\DefaultPhoneRegionSet' => __DIR__ . '/..' . '/../lib/SetupChecks/DefaultPhoneRegionSet.php',
|
||||
'OCA\\Settings\\SetupChecks\\EmailTestSuccessful' => __DIR__ . '/..' . '/../lib/SetupChecks/EmailTestSuccessful.php',
|
||||
'OCA\\Settings\\SetupChecks\\FairUseOfFreePushService' => __DIR__ . '/..' . '/../lib/SetupChecks/FairUseOfFreePushService.php',
|
||||
'OCA\\Settings\\SetupChecks\\FileLocking' => __DIR__ . '/..' . '/../lib/SetupChecks/FileLocking.php',
|
||||
'OCA\\Settings\\SetupChecks\\ForwardedForHeaders' => __DIR__ . '/..' . '/../lib/SetupChecks/ForwardedForHeaders.php',
|
||||
'OCA\\Settings\\SetupChecks\\InternetConnectivity' => __DIR__ . '/..' . '/../lib/SetupChecks/InternetConnectivity.php',
|
||||
|
|
@ -122,6 +121,7 @@ class ComposerStaticInitSettings
|
|||
'OCA\\Settings\\SetupChecks\\PhpOpcacheSetup' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpOpcacheSetup.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpOutdated' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpOutdated.php',
|
||||
'OCA\\Settings\\SetupChecks\\PhpOutputBuffering' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpOutputBuffering.php',
|
||||
'OCA\\Settings\\SetupChecks\\PushService' => __DIR__ . '/..' . '/../lib/SetupChecks/PushService.php',
|
||||
'OCA\\Settings\\SetupChecks\\RandomnessSecure' => __DIR__ . '/..' . '/../lib/SetupChecks/RandomnessSecure.php',
|
||||
'OCA\\Settings\\SetupChecks\\ReadOnlyConfig' => __DIR__ . '/..' . '/../lib/SetupChecks/ReadOnlyConfig.php',
|
||||
'OCA\\Settings\\SetupChecks\\SupportedDatabase' => __DIR__ . '/..' . '/../lib/SetupChecks/SupportedDatabase.php',
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ use OCA\Settings\SetupChecks\DatabaseHasMissingPrimaryKeys;
|
|||
use OCA\Settings\SetupChecks\DatabasePendingBigIntConversions;
|
||||
use OCA\Settings\SetupChecks\DefaultPhoneRegionSet;
|
||||
use OCA\Settings\SetupChecks\EmailTestSuccessful;
|
||||
use OCA\Settings\SetupChecks\FairUseOfFreePushService;
|
||||
use OCA\Settings\SetupChecks\FileLocking;
|
||||
use OCA\Settings\SetupChecks\ForwardedForHeaders;
|
||||
use OCA\Settings\SetupChecks\InternetConnectivity;
|
||||
|
|
@ -79,6 +78,7 @@ use OCA\Settings\SetupChecks\PhpModules;
|
|||
use OCA\Settings\SetupChecks\PhpOpcacheSetup;
|
||||
use OCA\Settings\SetupChecks\PhpOutdated;
|
||||
use OCA\Settings\SetupChecks\PhpOutputBuffering;
|
||||
use OCA\Settings\SetupChecks\PushService;
|
||||
use OCA\Settings\SetupChecks\RandomnessSecure;
|
||||
use OCA\Settings\SetupChecks\ReadOnlyConfig;
|
||||
use OCA\Settings\SetupChecks\SupportedDatabase;
|
||||
|
|
@ -210,9 +210,7 @@ class Application extends App implements IBootstrap {
|
|||
$context->registerSetupCheck(SystemIs64bit::class);
|
||||
$context->registerSetupCheck(TempSpaceAvailable::class);
|
||||
$context->registerSetupCheck(TransactionIsolation::class);
|
||||
if (!\OCP\Server::get(\OCP\Support\Subscription\IRegistry::class)->delegateHasValidSubscription()) {
|
||||
$context->registerSetupCheck(FairUseOfFreePushService::class);
|
||||
}
|
||||
$context->registerSetupCheck(PushService::class);
|
||||
|
||||
$context->registerUserMigrator(AccountMigrator::class);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,22 +25,26 @@ declare(strict_types=1);
|
|||
*/
|
||||
namespace OCA\Settings\SetupChecks;
|
||||
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\Notification\IManager;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
use OCP\Support\Subscription\IRegistry;
|
||||
|
||||
class FairUseOfFreePushService implements ISetupCheck {
|
||||
class PushService implements ISetupCheck {
|
||||
public function __construct(
|
||||
private IL10N $l10n,
|
||||
private IConfig $config,
|
||||
private IManager $notificationsManager,
|
||||
private IRegistry $subscriptionRegistry,
|
||||
private ITimeFactory $timeFactory,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l10n->t('Free push service');
|
||||
return $this->l10n->t('Push service');
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
|
|
@ -52,7 +56,7 @@ class FairUseOfFreePushService implements ISetupCheck {
|
|||
*/
|
||||
private function isFairUseOfFreePushService(): bool {
|
||||
$rateLimitReached = (int) $this->config->getAppValue('notifications', 'rate_limit_reached', '0');
|
||||
if ($rateLimitReached >= (time() - 7 * 24 * 3600)) {
|
||||
if ($rateLimitReached >= ($this->timeFactory->now()->getTimestamp() - 7 * 24 * 3600)) {
|
||||
// Notifications app is showing a message already
|
||||
return true;
|
||||
}
|
||||
|
|
@ -60,8 +64,12 @@ class FairUseOfFreePushService implements ISetupCheck {
|
|||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
if ($this->subscriptionRegistry->delegateHasValidSubscription()) {
|
||||
return SetupResult::success($this->l10n->t('Valid enterprise license'));
|
||||
}
|
||||
|
||||
if ($this->isFairUseOfFreePushService()) {
|
||||
return SetupResult::success();
|
||||
return SetupResult::success($this->l10n->t('Free push service'));
|
||||
}
|
||||
|
||||
return SetupResult::error(
|
||||
Loading…
Reference in a new issue