Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/autopatches/20140410.accountsecret.2.php
| <?php | <?php | ||||
| echo "Updating users...\n"; | echo pht('Updating users...')."\n"; | ||||
| foreach (new LiskMigrationIterator(new PhabricatorUser()) as $user) { | foreach (new LiskMigrationIterator(new PhabricatorUser()) as $user) { | ||||
| $id = $user->getID(); | $id = $user->getID(); | ||||
| echo "Updating {$id}...\n"; | echo pht('Updating %d...', $id)."\n"; | ||||
| if (strlen($user->getAccountSecret())) { | if (strlen($user->getAccountSecret())) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| queryfx( | queryfx( | ||||
| $user->establishConnection('w'), | $user->establishConnection('w'), | ||||
| 'UPDATE %T SET accountSecret = %s WHERE id = %d', | 'UPDATE %T SET accountSecret = %s WHERE id = %d', | ||||
| $user->getTableName(), | $user->getTableName(), | ||||
| Filesystem::readRandomCharacters(64), | Filesystem::readRandomCharacters(64), | ||||
| $id); | $id); | ||||
| } | } | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||