Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14090866
D20129.id48064.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D20129.id48064.diff
View Options
diff --git a/src/applications/diffusion/query/DiffusionCommitQuery.php b/src/applications/diffusion/query/DiffusionCommitQuery.php
--- a/src/applications/diffusion/query/DiffusionCommitQuery.php
+++ b/src/applications/diffusion/query/DiffusionCommitQuery.php
@@ -202,6 +202,7 @@
$table = $this->newResultObject();
$conn = $table->establishConnection('r');
+ $empty_exception = null;
$subqueries = array();
if ($this->responsiblePHIDs) {
$base_authors = $this->authorPHIDs;
@@ -222,21 +223,33 @@
$this->authorPHIDs = $all_authors;
$this->auditorPHIDs = $base_auditors;
- $subqueries[] = $this->buildStandardPageQuery(
- $conn,
- $table->getTableName());
+ try {
+ $subqueries[] = $this->buildStandardPageQuery(
+ $conn,
+ $table->getTableName());
+ } catch (PhabricatorEmptyQueryException $ex) {
+ $empty_exception = $ex;
+ }
$this->authorPHIDs = $base_authors;
$this->auditorPHIDs = $all_auditors;
- $subqueries[] = $this->buildStandardPageQuery(
- $conn,
- $table->getTableName());
+ try {
+ $subqueries[] = $this->buildStandardPageQuery(
+ $conn,
+ $table->getTableName());
+ } catch (PhabricatorEmptyQueryException $ex) {
+ $empty_exception = $ex;
+ }
} else {
$subqueries[] = $this->buildStandardPageQuery(
$conn,
$table->getTableName());
}
+ if (!$subqueries) {
+ throw $empty_exception;
+ }
+
if (count($subqueries) > 1) {
$unions = null;
foreach ($subqueries as $subquery) {
@@ -642,10 +655,19 @@
}
if ($this->authorPHIDs !== null) {
+ $author_phids = $this->authorPHIDs;
+ if ($author_phids) {
+ $author_phids = $this->selectPossibleAuthors($author_phids);
+ if (!$author_phids) {
+ throw new PhabricatorEmptyQueryException(
+ pht('Author PHIDs contain no possible authors.'));
+ }
+ }
+
$where[] = qsprintf(
$conn,
'commit.authorPHID IN (%Ls)',
- $this->authorPHIDs);
+ $author_phids);
}
if ($this->epochMin !== null) {
@@ -934,5 +956,20 @@
) + $parent;
}
+ private function selectPossibleAuthors(array $phids) {
+ // See PHI1057. Select PHIDs which might possibly be commit authors from
+ // a larger list of PHIDs. This primarily filters out packages and projects
+ // from "Responsible Users: ..." queries. Our goal in performing this
+ // filtering is to improve the performance of the final query.
+
+ foreach ($phids as $key => $phid) {
+ if (phid_get_type($phid) !== PhabricatorPeopleUserPHIDType::TYPECONST) {
+ unset($phids[$key]);
+ }
+ }
+
+ return $phids;
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 8:52 PM (20 h, 16 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6786945
Default Alt Text
D20129.id48064.diff (2 KB)
Attached To
Mode
D20129: When building audit queries, prefilter possible "authorPHID" values
Attached
Detach File
Event Timeline
Log In to Comment