1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Call array_unique() in Handle/Object queries

Summary: I think the old thing did this, but this makes queries a bit less ridiculous. For example, `secure.phabricator.com` currently issues a query for 664 handles on my task list, but only 73 of them are unique (basically, all the projects plus all the authors). This proably is slightly good for performance, but mostly makes the "Services" tab manageable.

Test Plan: Looked at Maniphest and some other pages, saw handles and objects where they were expected to be.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D6959
This commit is contained in:
epriestley 2013-09-12 14:48:24 -07:00
parent ddfc6bbc9e
commit 926b47ef70
2 changed files with 7 additions and 5 deletions

View file

@ -3,7 +3,7 @@
final class PhabricatorHandleQuery
extends PhabricatorCursorPagedPolicyAwareQuery {
private $phids;
private $phids = array();
public function withPHIDs(array $phids) {
$this->phids = $phids;
@ -13,7 +13,7 @@ final class PhabricatorHandleQuery
public function loadPage() {
$types = PhabricatorPHIDType::getAllTypes();
$phids = $this->phids;
$phids = array_unique($this->phids);
if (!$phids) {
return array();
}

View file

@ -3,8 +3,8 @@
final class PhabricatorObjectQuery
extends PhabricatorCursorPagedPolicyAwareQuery {
private $phids;
private $names;
private $phids = array();
private $names = array();
private $namedResults;
@ -25,7 +25,7 @@ final class PhabricatorObjectQuery
$types = PhabricatorPHIDType::getAllTypes();
$names = $this->names;
$names = array_unique($this->names);
$phids = $this->phids;
// We allow objects to be named by their PHID in addition to their normal
@ -42,6 +42,8 @@ final class PhabricatorObjectQuery
}
}
$phids = array_unique($phids);
if ($names) {
$name_results = $this->loadObjectsByName($types, $names);
} else {