3 final class PhabricatorMailManagementUnverifyWorkflow
4 extends PhabricatorMailManagementWorkflow
{
6 protected function didConstruct() {
10 pht('Unverify an email address so it no longer receives mail.'))
11 ->setExamples('**unverify** __address__ ...')
15 'name' => 'addresses',
17 'help' => pht('Address (or addresses) to unverify.'),
22 public function execute(PhutilArgumentParser
$args) {
23 $console = PhutilConsole
::getConsole();
24 $viewer = $this->getViewer();
26 $addresses = $args->getArg('addresses');
28 throw new PhutilArgumentUsageException(
29 pht('Specify one or more email addresses to unverify.'));
32 foreach ($addresses as $address) {
33 $email = id(new PhabricatorUserEmail())->loadOneWhere(
40 'Address "%s" is unknown.',
45 $user_phid = $email->getUserPHID();
47 $user = id(new PhabricatorPeopleQuery())
49 ->withPHIDs(array($user_phid))
56 'Address "%s" belongs to invalid user "%s".',
62 if (!$email->getIsVerified()) {
66 'Address "%s" (owned by "%s") is already unverified.',
68 $user->getUsername()));
72 $email->openTransaction();
78 if ($email->getIsPrimary()) {
80 ->setIsEmailVerified(0)
84 $email->saveTransaction();
86 if ($email->getIsPrimary()) {
90 'Unverified "%s", the primary address for "%s".',
92 $user->getUsername()));
97 'Unverified "%s", an address for "%s".',
99 $user->getUsername()));