2012-02-29 06:06:34 +01:00
|
|
|
<?php
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Updating old commit authors...')."\n";
|
2012-02-29 06:06:34 +01:00
|
|
|
$table = new PhabricatorRepositoryCommit();
|
2013-01-17 02:55:39 +01:00
|
|
|
$table->openTransaction();
|
|
|
|
|
2012-02-29 06:06:34 +01:00
|
|
|
$conn = $table->establishConnection('w');
|
|
|
|
$data = new PhabricatorRepositoryCommitData();
|
|
|
|
$commits = queryfx_all(
|
|
|
|
$conn,
|
|
|
|
'SELECT c.id id, c.authorPHID authorPHID, d.commitDetails details
|
|
|
|
FROM %T c JOIN %T d ON d.commitID = c.id
|
2013-01-17 02:55:39 +01:00
|
|
|
WHERE c.authorPHID IS NULL
|
|
|
|
FOR UPDATE',
|
2012-02-29 06:06:34 +01:00
|
|
|
$table->getTableName(),
|
|
|
|
$data->getTableName());
|
|
|
|
|
|
|
|
foreach ($commits as $commit) {
|
|
|
|
$id = $commit['id'];
|
|
|
|
$details = json_decode($commit['details'], true);
|
|
|
|
$author_phid = idx($details, 'authorPHID');
|
|
|
|
if ($author_phid) {
|
|
|
|
queryfx(
|
|
|
|
$conn,
|
|
|
|
'UPDATE %T SET authorPHID = %s WHERE id = %d',
|
|
|
|
$table->getTableName(),
|
|
|
|
$author_phid,
|
|
|
|
$id);
|
|
|
|
echo "#{$id}\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-17 02:55:39 +01:00
|
|
|
$table->saveTransaction();
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Done.')."\n";
|
2012-02-29 06:06:34 +01:00
|
|
|
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Updating old commit %s...', 'mailKeys')."\n";
|
2013-01-17 02:55:39 +01:00
|
|
|
$table->openTransaction();
|
2012-02-29 06:06:34 +01:00
|
|
|
|
|
|
|
$commits = queryfx_all(
|
|
|
|
$conn,
|
2013-01-17 02:55:39 +01:00
|
|
|
'SELECT id FROM %T WHERE mailKey = %s FOR UPDATE',
|
2012-02-29 06:06:34 +01:00
|
|
|
$table->getTableName(),
|
|
|
|
'');
|
|
|
|
|
|
|
|
foreach ($commits as $commit) {
|
|
|
|
$id = $commit['id'];
|
|
|
|
queryfx(
|
|
|
|
$conn,
|
|
|
|
'UPDATE %T SET mailKey = %s WHERE id = %d',
|
|
|
|
$table->getTableName(),
|
|
|
|
Filesystem::readRandomCharacters(20),
|
|
|
|
$id);
|
|
|
|
echo "#{$id}\n";
|
|
|
|
}
|
|
|
|
|
2013-01-17 02:55:39 +01:00
|
|
|
$table->saveTransaction();
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Done.')."\n";
|