Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit e5b44d29 authored by Akhil's avatar Akhil
Browse files

Add more logging to the command

parent 573939c1
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -88,12 +88,12 @@ class MigrateWebmailAddressbooks extends Command {
				$emails[] = $email;
			}

			
			$this->commandOutput->writeln('Migrating ' . $limit . ' users starting at ' . $offset);
			$users = $this->webmailMapper->getUsers($limit, $offset, $emails);
			if (empty($users)) {
				return;
			}
			$this->webmailMapper->migrateContacts($users);
			$this->webmailMapper->migrateContacts($users, $this->commandOutput);
			return;
		}
		$users = $this->webmailMapper->getUsers($limit, $offset);
+7 −1
Original line number Diff line number Diff line
@@ -142,9 +142,15 @@ class WebmailMapper {
		}
	}

	public function migrateContacts(array $users) {
	public function migrateContacts(array $users, $commandOutput = null) {
		$userCount = 0;
		foreach ($users as $user) {
			$userCount += 1;
			if ($commandOutput) {
				$commandOutput->writeln('Migrating user ' . $userCount . ' with email: '.  $user['email']);
			}
			$contacts = $this->getUserContacts($user['id']);
			$commandOutput->writeln('Number of contacts for ' . $user['email'] . ':' . count($contacts));
			if (!count($contacts)) {
				return;
			}