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();
|
$audits = $query->execute();
|
||||||
$commits = $query->getCommits();
|
$commits = $query->getCommits();
|
||||||
|
|
||||||
// TODO: AuditQuery is currently not policy-aware and uses an old query
|
if ($commits) {
|
||||||
// to load commits. Load them in the modern way to get repositories. Remove
|
// TODO: AuditQuery is currently not policy-aware and uses an old query
|
||||||
// this after modernizing PhabricatorAuditQuery.
|
// to load commits. Load them in the modern way to get repositories.
|
||||||
$commits = id(new DiffusionCommitQuery())
|
// Remove this after modernizing PhabricatorAuditQuery.
|
||||||
->setViewer($viewer)
|
$commits = id(new DiffusionCommitQuery())
|
||||||
->withPHIDs(mpull($commits, 'getPHID'))
|
->setViewer($viewer)
|
||||||
->execute();
|
->withPHIDs(mpull($commits, 'getPHID'))
|
||||||
$commits = mpull($commits, null, 'getPHID');
|
->execute();
|
||||||
|
$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());
|
||||||
|
|
Loading…
Reference in a new issue