1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 15:22:41 +01:00

fix bin/audit to not query whole DB if no commits found

Summary: reported by csilvers in irc

Test Plan: ran a bum query with --trace and verified table scan not run

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran

Differential Revision: https://secure.phabricator.com/D6986
This commit is contained in:
Bob Trahan 2013-09-13 14:13:44 -07:00
parent 5e274778d1
commit 639bab3f89

View file

@ -103,14 +103,16 @@ final class PhabricatorAuditManagementDeleteWorkflow
$audits = $query->execute(); $audits = $query->execute();
$commits = $query->getCommits(); $commits = $query->getCommits();
if ($commits) {
// TODO: AuditQuery is currently not policy-aware and uses an old query // TODO: AuditQuery is currently not policy-aware and uses an old query
// to load commits. Load them in the modern way to get repositories. Remove // to load commits. Load them in the modern way to get repositories.
// this after modernizing PhabricatorAuditQuery. // Remove this after modernizing PhabricatorAuditQuery.
$commits = id(new DiffusionCommitQuery()) $commits = id(new DiffusionCommitQuery())
->setViewer($viewer) ->setViewer($viewer)
->withPHIDs(mpull($commits, 'getPHID')) ->withPHIDs(mpull($commits, 'getPHID'))
->execute(); ->execute();
$commits = mpull($commits, null, 'getPHID'); $commits = mpull($commits, null, 'getPHID');
}
foreach ($audits as $key => $audit) { foreach ($audits as $key => $audit) {
$commit = idx($commits, $audit->getCommitPHID()); $commit = idx($commits, $audit->getCommitPHID());