Skip to content

Commit

Permalink
Fix code problems
Browse files Browse the repository at this point in the history
  • Loading branch information
jvillafanez committed Oct 9, 2023
1 parent 92ef028 commit d7ee212
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/Command/Sync/Sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private function checkLocalData(ISyncer $syncer, $opts, OutputInterface $output)
$output->writeln('Checking local data');
$progress = new ProgressBar($output);
$progress->start($syncer->localItemCount($opts));
$syncer->check(function ($item, $state) use ($output, $progress, &$itemStateList, &$errorList) {
$syncer->check(function ($item, $state) use ($progress, &$itemStateList, &$errorList) {
if (\is_array($item) && $state !== ISyncer::CHECK_STATE_NO_CHANGE) {
$key = \array_key_first($item);
$itemStateList[] = [
Expand Down Expand Up @@ -168,7 +168,7 @@ private function syncRemoteData(ISyncer $syncer, $opts, OutputInterface $output)
$output->writeln('Syncing remote data');
$progress = new ProgressBar($output);
$progress->start($syncer->remoteItemCount($opts));
$syncer->sync(function ($item) use ($output, $progress, &$errorList) {
$syncer->sync(function ($item) use ($progress, &$errorList) {
if ($item instanceof \Exception) {
$errorList[] = $item;
} else {
Expand Down
4 changes: 4 additions & 0 deletions lib/private/Sync/User/UserSyncer.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ public function checkOne(string $id, $opts = []): string {
throw new SyncBackendUserFailedException("The database returned multiple accounts for this uid: $id");
}

if (!empty($backends) && !\in_array($targetBackend, $backends)) {
throw new SyncBackendUserFailedException("User found not belonging to any of the requested backends");
}

foreach ($this->userSyncBackends as $userSyncBackend) {
if (!isset($targetBackend) || \get_class($userSyncBackend->getUserInterface()) === $targetBackend) {
$syncingUser = $userSyncBackend->getSyncingUser($id);
Expand Down

0 comments on commit d7ee212

Please sign in to comment.