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:
parent
5e274778d1
commit
639bab3f89
1 changed files with 10 additions and 8 deletions
|
@ -103,14 +103,16 @@ final class PhabricatorAuditManagementDeleteWorkflow
|
|||
$audits = $query->execute();
|
||||
$commits = $query->getCommits();
|
||||
|
||||
if ($commits) {
|
||||
// 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
|
||||
// this after modernizing PhabricatorAuditQuery.
|
||||
// to load commits. Load them in the modern way to get repositories.
|
||||
// Remove this after modernizing PhabricatorAuditQuery.
|
||||
$commits = id(new DiffusionCommitQuery())
|
||||
->setViewer($viewer)
|
||||
->withPHIDs(mpull($commits, 'getPHID'))
|
||||
->execute();
|
||||
$commits = mpull($commits, null, 'getPHID');
|
||||
}
|
||||
|
||||
foreach ($audits as $key => $audit) {
|
||||
$commit = idx($commits, $audit->getCommitPHID());
|
||||
|
|
Loading…
Reference in a new issue