[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/resources/sql/patches/ -> 20130711.trimrealnames.php (source)

   1  <?php
   2  
   3  $table = new PhabricatorUser();
   4  $conn_w = $table->establishConnection('w');
   5  
   6  echo "Trimming trailing whitespace from user real names...\n";
   7  foreach (new LiskMigrationIterator($table) as $user) {
   8    $id = $user->getID();
   9    $real = $user->getRealName();
  10    $trim = rtrim($real);
  11  
  12    if ($trim == $real) {
  13      echo "User {$id} is already trim.\n";
  14      continue;
  15    }
  16  
  17    echo "Trimming user {$id} from '{$real}' to '{$trim}'.\n";
  18    qsprintf(
  19      $conn_w,
  20      'UPDATE %T SET realName = %s WHERE id = %d',
  21      $table->getTableName(),
  22      $real,
  23      $id);
  24  }
  25  
  26  echo "Done.\n";


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