Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15433540
D15560.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D15560.diff
View Options
diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php
--- a/src/applications/maniphest/query/ManiphestTaskQuery.php
+++ b/src/applications/maniphest/query/ManiphestTaskQuery.php
@@ -329,7 +329,6 @@
$where = parent::buildWhereClauseParts($conn);
$where[] = $this->buildStatusWhereClause($conn);
- $where[] = $this->buildDependenciesWhereClause($conn);
$where[] = $this->buildOwnerWhereClause($conn);
$where[] = $this->buildFullTextWhereClause($conn);
@@ -513,42 +512,6 @@
$fulltext_results);
}
- private function buildDependenciesWhereClause(
- AphrontDatabaseConnection $conn) {
-
- if (!$this->shouldJoinBlockedTasks() &&
- !$this->shouldJoinBlockingTasks()) {
- return null;
- }
-
- $parts = array();
- if ($this->blockingTasks === true) {
- $parts[] = qsprintf(
- $conn,
- 'blocking.dst IS NOT NULL AND blockingtask.status IN (%Ls)',
- ManiphestTaskStatus::getOpenStatusConstants());
- } else if ($this->blockingTasks === false) {
- $parts[] = qsprintf(
- $conn,
- 'blocking.dst IS NULL OR blockingtask.status NOT IN (%Ls)',
- ManiphestTaskStatus::getOpenStatusConstants());
- }
-
- if ($this->blockedTasks === true) {
- $parts[] = qsprintf(
- $conn,
- 'blocked.dst IS NOT NULL AND blockedtask.status IN (%Ls)',
- ManiphestTaskStatus::getOpenStatusConstants());
- } else if ($this->blockedTasks === false) {
- $parts[] = qsprintf(
- $conn,
- 'blocked.dst IS NULL OR blockedtask.status NOT IN (%Ls)',
- ManiphestTaskStatus::getOpenStatusConstants());
- }
-
- return '('.implode(') OR (', $parts).')';
- }
-
protected function buildJoinClauseParts(AphrontDatabaseConnection $conn_r) {
$edge_table = PhabricatorEdgeConfig::TABLE_NAME_EDGE;
@@ -559,20 +522,24 @@
$conn_r,
'LEFT JOIN %T blocking ON blocking.src = task.phid '.
'AND blocking.type = %d '.
- 'LEFT JOIN %T blockingtask ON blocking.dst = blockingtask.phid',
+ 'LEFT JOIN %T blockingtask ON blocking.dst = blockingtask.phid '.
+ 'AND blockingtask.status IN (%Ls)',
$edge_table,
ManiphestTaskDependedOnByTaskEdgeType::EDGECONST,
- id(new ManiphestTask())->getTableName());
+ id(new ManiphestTask())->getTableName(),
+ ManiphestTaskStatus::getOpenStatusConstants());
}
if ($this->shouldJoinBlockedTasks()) {
$joins[] = qsprintf(
$conn_r,
'LEFT JOIN %T blocked ON blocked.src = task.phid '.
'AND blocked.type = %d '.
- 'LEFT JOIN %T blockedtask ON blocked.dst = blockedtask.phid',
+ 'LEFT JOIN %T blockedtask ON blocked.dst = blockedtask.phid '.
+ 'AND blockedtask.status IN (%Ls)',
$edge_table,
ManiphestTaskDependsOnTaskEdgeType::EDGECONST,
- id(new ManiphestTask())->getTableName());
+ id(new ManiphestTask())->getTableName(),
+ ManiphestTaskStatus::getOpenStatusConstants());
}
if ($this->subscriberPHIDs !== null) {
@@ -687,6 +654,38 @@
return array_mergev($phids);
}
+ protected function buildHavingClauseParts(AphrontDatabaseConnection $conn) {
+ $having = parent::buildHavingClauseParts($conn);
+
+ $having[] = $this->buildDependenciesHavingClause($conn);
+
+ return $having;
+ }
+
+ private function buildDependenciesHavingClause(
+ AphrontDatabaseConnection $conn) {
+
+ if (!$this->shouldJoinBlockedTasks() &&
+ !$this->shouldJoinBlockingTasks()) {
+ return null;
+ }
+
+ $parts = array();
+ if ($this->blockingTasks === true) {
+ $parts[] = 'COUNT(blockingtask.phid) > 0';
+ } else if ($this->blockingTasks === false) {
+ $parts[] = 'COUNT(blockingtask.phid) = 0';
+ }
+
+ if ($this->blockedTasks === true) {
+ $parts[] = 'COUNT(blockedtask.phid) > 0';
+ } else if ($this->blockedTasks === false) {
+ $parts[] = 'COUNT(blockedtask.phid) = 0';
+ }
+
+ return '('.implode(') OR (', $parts).')';
+ }
+
protected function getResultCursor($result) {
$id = $result->getID();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 25, 11:42 PM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7576287
Default Alt Text
D15560.diff (4 KB)
Attached To
Mode
D15560: Improve task dependency queries (Fixes T8126)
Attached
Detach File
Event Timeline
Log In to Comment