[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/resources/sql/patches/ -> 20131112.userverified.2.mig.php (source)

   1  <?php
   2  
   3  $table = new PhabricatorUser();
   4  $conn_w = $table->establishConnection('w');
   5  
   6  foreach (new LiskMigrationIterator($table) as $user) {
   7    $username = $user->getUsername();
   8    echo "Migrating {$username}...\n";
   9    if ($user->getIsEmailVerified()) {
  10      // Email already verified.
  11      continue;
  12    }
  13  
  14    $primary = $user->loadPrimaryEmail();
  15    if (!$primary) {
  16      // No primary email.
  17      continue;
  18    }
  19  
  20    if (!$primary->getIsVerified()) {
  21      // Primary email not verified.
  22      continue;
  23    }
  24  
  25    // Primary email is verified, so mark the account as verified.
  26    queryfx(
  27      $conn_w,
  28      'UPDATE %T SET isEmailVerified = 1 WHERE id = %d',
  29      $table->getTableName(),
  30      $user->getID());
  31  }
  32  
  33  echo "Done.\n";


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1