2014-03-26 03:43:26 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$conn_w = id(new PhabricatorRepository())->establishConnection('w');
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Adding transaction log event groups...')."\n";
|
2014-03-26 03:43:26 +01:00
|
|
|
|
|
|
|
$logs = queryfx_all(
|
|
|
|
$conn_w,
|
|
|
|
'SELECT * FROM %T GROUP BY transactionKey ORDER BY id ASC',
|
|
|
|
'repository_pushlog');
|
|
|
|
foreach ($logs as $log) {
|
|
|
|
$id = $log['id'];
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Migrating log %d...', $id)."\n";
|
2014-03-26 03:43:26 +01:00
|
|
|
if ($log['pushEventPHID']) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
$event_phid = id(new PhabricatorRepositoryPushEvent())->generatePHID();
|
|
|
|
|
|
|
|
queryfx(
|
|
|
|
$conn_w,
|
|
|
|
'INSERT INTO %T (phid, repositoryPHID, epoch, pusherPHID, remoteAddress,
|
|
|
|
remoteProtocol, rejectCode, rejectDetails)
|
|
|
|
VALUES (%s, %s, %d, %s, %d, %s, %d, %s)',
|
|
|
|
'repository_pushevent',
|
|
|
|
$event_phid,
|
|
|
|
$log['repositoryPHID'],
|
|
|
|
$log['epoch'],
|
|
|
|
$log['pusherPHID'],
|
|
|
|
$log['remoteAddress'],
|
|
|
|
$log['remoteProtocol'],
|
|
|
|
$log['rejectCode'],
|
|
|
|
$log['rejectDetails']);
|
|
|
|
|
|
|
|
queryfx(
|
|
|
|
$conn_w,
|
|
|
|
'UPDATE %T SET pushEventPHID = %s WHERE transactionKey = %s',
|
|
|
|
'repository_pushlog',
|
|
|
|
$event_phid,
|
|
|
|
$log['transactionKey']);
|
|
|
|
}
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Done.')."\n";
|