@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Namespace all column references in ProjectQuery to fix ambiguity with Ferret constraints

Summary:
Fixes T13378. If we join Ferret tables and page, we can end up with an ambiguous `id` column here.

Explicitly refer to "project.x" in all cases that we're interacting with the project table.

Test Plan:
- Changed page size to 3.
- Issued a Projects query for "~e", matching more than 3 results.
- Clicked "Next Page".
- Before: ambiguous id column fatal.
- After: next page.

Maniphest Tasks: T13378

Differential Revision: https://secure.phabricator.com/D20714

+24 -24
+24 -24
src/applications/project/query/PhabricatorProjectQuery.php
··· 464 464 } 465 465 $where[] = qsprintf( 466 466 $conn, 467 - 'status IN (%Ld)', 467 + 'project.status IN (%Ld)', 468 468 $filter); 469 469 } 470 470 471 471 if ($this->statuses !== null) { 472 472 $where[] = qsprintf( 473 473 $conn, 474 - 'status IN (%Ls)', 474 + 'project.status IN (%Ls)', 475 475 $this->statuses); 476 476 } 477 477 478 478 if ($this->ids !== null) { 479 479 $where[] = qsprintf( 480 480 $conn, 481 - 'id IN (%Ld)', 481 + 'project.id IN (%Ld)', 482 482 $this->ids); 483 483 } 484 484 485 485 if ($this->phids !== null) { 486 486 $where[] = qsprintf( 487 487 $conn, 488 - 'phid IN (%Ls)', 488 + 'project.phid IN (%Ls)', 489 489 $this->phids); 490 490 } 491 491 ··· 513 513 if ($this->names !== null) { 514 514 $where[] = qsprintf( 515 515 $conn, 516 - 'name IN (%Ls)', 516 + 'project.name IN (%Ls)', 517 517 $this->names); 518 518 } 519 519 ··· 522 522 foreach ($this->namePrefixes as $name_prefix) { 523 523 $parts[] = qsprintf( 524 524 $conn, 525 - 'name LIKE %>', 525 + 'project.name LIKE %>', 526 526 $name_prefix); 527 527 } 528 528 $where[] = qsprintf($conn, '%LO', $parts); ··· 531 531 if ($this->icons !== null) { 532 532 $where[] = qsprintf( 533 533 $conn, 534 - 'icon IN (%Ls)', 534 + 'project.icon IN (%Ls)', 535 535 $this->icons); 536 536 } 537 537 538 538 if ($this->colors !== null) { 539 539 $where[] = qsprintf( 540 540 $conn, 541 - 'color IN (%Ls)', 541 + 'project.color IN (%Ls)', 542 542 $this->colors); 543 543 } 544 544 545 545 if ($this->parentPHIDs !== null) { 546 546 $where[] = qsprintf( 547 547 $conn, 548 - 'parentProjectPHID IN (%Ls)', 548 + 'project.parentProjectPHID IN (%Ls)', 549 549 $this->parentPHIDs); 550 550 } 551 551 ··· 563 563 foreach ($ancestor_paths as $ancestor_path) { 564 564 $sql[] = qsprintf( 565 565 $conn, 566 - '(projectPath LIKE %> AND projectDepth > %d)', 566 + '(project.projectPath LIKE %> AND project.projectDepth > %d)', 567 567 $ancestor_path['projectPath'], 568 568 $ancestor_path['projectDepth']); 569 569 } ··· 572 572 573 573 $where[] = qsprintf( 574 574 $conn, 575 - 'parentProjectPHID IS NOT NULL'); 575 + 'project.parentProjectPHID IS NOT NULL'); 576 576 } 577 577 578 578 if ($this->isMilestone !== null) { 579 579 if ($this->isMilestone) { 580 580 $where[] = qsprintf( 581 581 $conn, 582 - 'milestoneNumber IS NOT NULL'); 582 + 'project.milestoneNumber IS NOT NULL'); 583 583 } else { 584 584 $where[] = qsprintf( 585 585 $conn, 586 - 'milestoneNumber IS NULL'); 586 + 'project.milestoneNumber IS NULL'); 587 587 } 588 588 } 589 589 ··· 591 591 if ($this->hasSubprojects !== null) { 592 592 $where[] = qsprintf( 593 593 $conn, 594 - 'hasSubprojects = %d', 594 + 'project.hasSubprojects = %d', 595 595 (int)$this->hasSubprojects); 596 596 } 597 597 598 598 if ($this->minDepth !== null) { 599 599 $where[] = qsprintf( 600 600 $conn, 601 - 'projectDepth >= %d', 601 + 'project.projectDepth >= %d', 602 602 $this->minDepth); 603 603 } 604 604 605 605 if ($this->maxDepth !== null) { 606 606 $where[] = qsprintf( 607 607 $conn, 608 - 'projectDepth <= %d', 608 + 'project.projectDepth <= %d', 609 609 $this->maxDepth); 610 610 } 611 611 612 612 if ($this->minMilestoneNumber !== null) { 613 613 $where[] = qsprintf( 614 614 $conn, 615 - 'milestoneNumber >= %d', 615 + 'project.milestoneNumber >= %d', 616 616 $this->minMilestoneNumber); 617 617 } 618 618 619 619 if ($this->maxMilestoneNumber !== null) { 620 620 $where[] = qsprintf( 621 621 $conn, 622 - 'milestoneNumber <= %d', 622 + 'project.milestoneNumber <= %d', 623 623 $this->maxMilestoneNumber); 624 624 } 625 625 626 626 if ($this->subtypes !== null) { 627 627 $where[] = qsprintf( 628 628 $conn, 629 - 'subtype IN (%Ls)', 629 + 'project.subtype IN (%Ls)', 630 630 $this->subtypes); 631 631 } 632 632 ··· 646 646 if ($this->memberPHIDs !== null) { 647 647 $joins[] = qsprintf( 648 648 $conn, 649 - 'JOIN %T e ON e.src = p.phid AND e.type = %d', 649 + 'JOIN %T e ON e.src = project.phid AND e.type = %d', 650 650 PhabricatorEdgeConfig::TABLE_NAME_EDGE, 651 651 PhabricatorProjectMaterializedMemberEdgeType::EDGECONST); 652 652 } ··· 654 654 if ($this->watcherPHIDs !== null) { 655 655 $joins[] = qsprintf( 656 656 $conn, 657 - 'JOIN %T w ON w.src = p.phid AND w.type = %d', 657 + 'JOIN %T w ON w.src = project.phid AND w.type = %d', 658 658 PhabricatorEdgeConfig::TABLE_NAME_EDGE, 659 659 PhabricatorObjectHasWatcherEdgeType::EDGECONST); 660 660 } ··· 662 662 if ($this->slugs !== null) { 663 663 $joins[] = qsprintf( 664 664 $conn, 665 - 'JOIN %T slug on slug.projectPHID = p.phid', 665 + 'JOIN %T slug on slug.projectPHID = project.phid', 666 666 id(new PhabricatorProjectSlug())->getTableName()); 667 667 } 668 668 ··· 672 672 $token_table = 'token_'.$key; 673 673 $joins[] = qsprintf( 674 674 $conn, 675 - 'JOIN %T %T ON %T.projectID = p.id AND %T.token LIKE %>', 675 + 'JOIN %T %T ON %T.projectID = project.id AND %T.token LIKE %>', 676 676 PhabricatorProject::TABLE_DATASOURCE_TOKEN, 677 677 $token_table, 678 678 $token_table, ··· 689 689 } 690 690 691 691 protected function getPrimaryTableAlias() { 692 - return 'p'; 692 + return 'project'; 693 693 } 694 694 695 695 private function linkProjectGraph(array $projects, array $ancestors) {