appName = Application::APP_ID; $this->userManager = $userManager; $this->config = $config; $this->jobList = $jobList; // Run once a week $this->setInterval(7 * 24 * 60 * 60); /** * @todo remove check with 24+ */ if (method_exists($this, 'setTimeSensitivity')) { $this->setTimeSensitivity(self::TIME_INSENSITIVE); } } /** * @inheritDoc */ #[\Override] protected function run($argument) { // check if admin allows for social updates: $syncAllowedByAdmin = $this->config->getAppValue($this->appName, 'allowSocialSync', 'yes'); if (!($syncAllowedByAdmin === 'yes')) { return; } $this->userManager->callForSeenUsers(function (IUser $user) { // check that user opted-in: $bgSyncEnabledByUser = $this->config->getUserValue($user->getUID(), $this->appName, 'enableSocialSync', 'no'); if ($bgSyncEnabledByUser === 'yes' && $user->isEnabled()) { $this->jobList->add(SocialUpdate::class, [ 'userId' => $user->getUID(), 'offsetBook' => null, 'offsetContact' => null ]); } }); } }