1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 18:52:42 +01:00
phorge-phorge/resources/sql/autopatches/20160824.repohint.02.movebad.php

40 lines
898 B
PHP
Raw Normal View History

<?php
$table = new PhabricatorRepositoryCommit();
$conn = $table->establishConnection('w');
$rows = queryfx_all(
$conn,
'SELECT fullCommitName FROM repository_badcommit');
$viewer = PhabricatorUser::getOmnipotentUser();
foreach ($rows as $row) {
$identifier = $row['fullCommitName'];
$commit = id(new DiffusionCommitQuery())
->setViewer($viewer)
->withIdentifiers(array($identifier))
->executeOne();
if (!$commit) {
echo tsprintf(
"%s\n",
pht(
'Skipped hint for "%s", this is not a valid commit.',
$identifier));
} else {
PhabricatorRepositoryCommitHint::updateHint(
$commit->getRepository()->getPHID(),
$commit->getCommitIdentifier(),
null,
PhabricatorRepositoryCommitHint::HINT_UNREADABLE);
echo tsprintf(
"%s\n",
pht(
'Updated commit hint for "%s".',
$identifier));
}
}