diff options
author | Georg Ehrke <developer@georgehrke.com> | 2019-05-23 11:10:48 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2019-05-23 11:24:32 +0200 |
commit | 7ec8e6d35b2e0cd2417456772eb2708132460ce7 (patch) | |
tree | 50274defe5c67264246b97bb7b13e1428595df1f /apps/dav/lib/Migration | |
parent | e38f55d78811f40b8b1350a0a3098e489703c735 (diff) | |
download | nextcloud-server-7ec8e6d35b2e0cd2417456772eb2708132460ce7.tar.gz nextcloud-server-7ec8e6d35b2e0cd2417456772eb2708132460ce7.zip |
Don't run repair step for every individual user, outsource that to background job
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/lib/Migration')
-rw-r--r-- | apps/dav/lib/Migration/RegenerateBirthdayCalendars.php | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php b/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php index 263e6d00db4..492ae876e8a 100644 --- a/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php +++ b/apps/dav/lib/Migration/RegenerateBirthdayCalendars.php @@ -22,19 +22,14 @@ */ namespace OCA\DAV\Migration; -use OCA\DAV\BackgroundJob\GenerateBirthdayCalendarBackgroundJob; +use OCA\DAV\BackgroundJob\RegisterRegenerateBirthdayCalendars; use OCP\BackgroundJob\IJobList; use OCP\IConfig; -use OCP\IUser; -use OCP\IUserManager; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; class RegenerateBirthdayCalendars implements IRepairStep { - /** @var IUserManager */ - private $userManager; - /** @var IJobList */ private $jobList; @@ -42,14 +37,11 @@ class RegenerateBirthdayCalendars implements IRepairStep { private $config; /** - * @param IUserManager $userManager, * @param IJobList $jobList * @param IConfig $config */ - public function __construct(IUserManager $userManager, - IJobList $jobList, + public function __construct(IJobList $jobList, IConfig $config) { - $this->userManager = $userManager; $this->jobList = $jobList; $this->config = $config; } @@ -72,12 +64,7 @@ class RegenerateBirthdayCalendars implements IRepairStep { } $output->info('Adding background jobs to regenerate birthday calendar'); - $this->userManager->callForSeenUsers(function(IUser $user) { - $this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [ - 'userId' => $user->getUID(), - 'purgeBeforeGenerating' => true - ]); - }); + $this->jobList->add(RegisterRegenerateBirthdayCalendars::class); // if all were done, no need to redo the repair during next upgrade $this->config->setAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix', 'yes'); |