Merge pull request #15141 from nextcloud/fix/noid/regenerate-seen-users-only
fix searching all users in repair regenerate birthday cal reparir job
This commit is contained in:
commit
33946655b9
|
@ -319,7 +319,7 @@ class SyncService {
|
||||||
|
|
||||||
public function syncInstance(\Closure $progressCallback = null) {
|
public function syncInstance(\Closure $progressCallback = null) {
|
||||||
$systemAddressBook = $this->getLocalSystemAddressBook();
|
$systemAddressBook = $this->getLocalSystemAddressBook();
|
||||||
$this->userManager->callForAllUsers(function($user) use ($systemAddressBook, $progressCallback) {
|
$this->userManager->callForSeenUsers(function($user) use ($systemAddressBook, $progressCallback) {
|
||||||
$this->updateUser($user);
|
$this->updateUser($user);
|
||||||
if (!is_null($progressCallback)) {
|
if (!is_null($progressCallback)) {
|
||||||
$progressCallback();
|
$progressCallback();
|
||||||
|
|
|
@ -92,7 +92,7 @@ class SyncBirthdayCalendar extends Command {
|
||||||
$output->writeln("Start birthday calendar sync for all users ...");
|
$output->writeln("Start birthday calendar sync for all users ...");
|
||||||
$p = new ProgressBar($output);
|
$p = new ProgressBar($output);
|
||||||
$p->start();
|
$p->start();
|
||||||
$this->userManager->callForAllUsers(function($user) use ($p) {
|
$this->userManager->callForSeenUsers(function($user) use ($p) {
|
||||||
$p->advance();
|
$p->advance();
|
||||||
|
|
||||||
$userId = $user->getUID();
|
$userId = $user->getUID();
|
||||||
|
|
|
@ -93,7 +93,7 @@ class BirthdayCalendarController extends Controller {
|
||||||
$this->config->setAppValue($this->appName, 'generateBirthdayCalendar', 'yes');
|
$this->config->setAppValue($this->appName, 'generateBirthdayCalendar', 'yes');
|
||||||
|
|
||||||
// add background job for each user
|
// add background job for each user
|
||||||
$this->userManager->callForAllUsers(function(IUser $user) {
|
$this->userManager->callForSeenUsers(function(IUser $user) {
|
||||||
$this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [
|
$this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [
|
||||||
'userId' => $user->getUID(),
|
'userId' => $user->getUID(),
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -72,7 +72,7 @@ class RegenerateBirthdayCalendars implements IRepairStep {
|
||||||
}
|
}
|
||||||
|
|
||||||
$output->info('Adding background jobs to regenerate birthday calendar');
|
$output->info('Adding background jobs to regenerate birthday calendar');
|
||||||
$this->userManager->callForAllUsers(function(IUser $user) {
|
$this->userManager->callForSeenUsers(function(IUser $user) {
|
||||||
$this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [
|
$this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [
|
||||||
'userId' => $user->getUID(),
|
'userId' => $user->getUID(),
|
||||||
'purgeBeforeGenerating' => true
|
'purgeBeforeGenerating' => true
|
||||||
|
|
|
@ -78,7 +78,7 @@ class BirthdayCalendarControllerTest extends TestCase {
|
||||||
->with('dav', 'generateBirthdayCalendar', 'yes');
|
->with('dav', 'generateBirthdayCalendar', 'yes');
|
||||||
|
|
||||||
$this->userManager->expects($this->once())
|
$this->userManager->expects($this->once())
|
||||||
->method('callForAllUsers')
|
->method('callForSeenUsers')
|
||||||
->will($this->returnCallback(function($closure) {
|
->will($this->returnCallback(function($closure) {
|
||||||
$user1 = $this->createMock(IUser::class);
|
$user1 = $this->createMock(IUser::class);
|
||||||
$user1->method('getUID')->will($this->returnValue('uid1'));
|
$user1->method('getUID')->will($this->returnValue('uid1'));
|
||||||
|
|
|
@ -76,7 +76,7 @@ class RegenerateBirthdayCalendarsTest extends TestCase {
|
||||||
->with('Adding background jobs to regenerate birthday calendar');
|
->with('Adding background jobs to regenerate birthday calendar');
|
||||||
|
|
||||||
$this->userManager->expects($this->once())
|
$this->userManager->expects($this->once())
|
||||||
->method('callForAllUsers')
|
->method('callForSeenUsers')
|
||||||
->will($this->returnCallback(function($closure) {
|
->will($this->returnCallback(function($closure) {
|
||||||
$user1 = $this->createMock(IUser::class);
|
$user1 = $this->createMock(IUser::class);
|
||||||
$user1->method('getUID')->will($this->returnValue('uid1'));
|
$user1->method('getUID')->will($this->returnValue('uid1'));
|
||||||
|
@ -128,7 +128,7 @@ class RegenerateBirthdayCalendarsTest extends TestCase {
|
||||||
->with('Repair step already executed');
|
->with('Repair step already executed');
|
||||||
|
|
||||||
$this->userManager->expects($this->never())
|
$this->userManager->expects($this->never())
|
||||||
->method('callForAllUsers');
|
->method('callForSeenUsers');
|
||||||
|
|
||||||
$this->migration->run($output);
|
$this->migration->run($output);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,6 @@ namespace OC\User;
|
||||||
|
|
||||||
use OC\Cache\CappedMemoryCache;
|
use OC\Cache\CappedMemoryCache;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\User\Backend\ABackend;
|
use OCP\User\Backend\ABackend;
|
||||||
use OCP\User\Backend\ICheckPasswordBackend;
|
use OCP\User\Backend\ICheckPasswordBackend;
|
||||||
use OCP\User\Backend\ICountUsersBackend;
|
use OCP\User\Backend\ICountUsersBackend;
|
||||||
|
@ -68,7 +67,6 @@ use OCP\User\Backend\IGetDisplayNameBackend;
|
||||||
use OCP\User\Backend\IGetHomeBackend;
|
use OCP\User\Backend\IGetHomeBackend;
|
||||||
use OCP\User\Backend\ISetDisplayNameBackend;
|
use OCP\User\Backend\ISetDisplayNameBackend;
|
||||||
use OCP\User\Backend\ISetPasswordBackend;
|
use OCP\User\Backend\ISetPasswordBackend;
|
||||||
use OCP\Util;
|
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
use Symfony\Component\EventDispatcher\GenericEvent;
|
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue