Something went wrong. Try again.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
Something went wrong. Try again.
PHP
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859<?php
echo pht('Updating old commit authors...')."\n";$table = new PhabricatorRepositoryCommit();$table->openTransaction();
$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 WHERE c.authorPHID IS NULL FOR UPDATE', $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"; }}
$table->saveTransaction();echo pht('Done.')."\n";
echo pht('Updating old commit %s...', 'mailKeys')."\n";$table->openTransaction();
$commits = queryfx_all( $conn, 'SELECT id FROM %T WHERE mailKey = %s FOR UPDATE', $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";}
$table->saveTransaction();echo pht('Done.')."\n";