Changeset View
Changeset View
Standalone View
Standalone View
src/applications/owners/query/PhabricatorOwnersPackageQuery.php
| Show First 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | if ($this->ownerPHIDs !== null) { | ||||
| $conn, | $conn, | ||||
| 'o.userPHID IN (%Ls)', | 'o.userPHID IN (%Ls)', | ||||
| $this->ownerPHIDs); | $this->ownerPHIDs); | ||||
| } | } | ||||
| if ($this->paths !== null) { | if ($this->paths !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn, | $conn, | ||||
| 'rpath.path IN (%Ls)', | 'rpath.pathIndex IN (%Ls)', | ||||
| $this->getFragmentsForPaths($this->paths)); | $this->getFragmentIndexesForPaths($this->paths)); | ||||
| } | } | ||||
| if ($this->statuses !== null) { | if ($this->statuses !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn, | $conn, | ||||
| 'p.status IN (%Ls)', | 'p.status IN (%Ls)', | ||||
| $this->statuses); | $this->statuses); | ||||
| } | } | ||||
| if ($this->controlMap) { | if ($this->controlMap) { | ||||
| $clauses = array(); | $clauses = array(); | ||||
| foreach ($this->controlMap as $repository_phid => $paths) { | foreach ($this->controlMap as $repository_phid => $paths) { | ||||
| $fragments = $this->getFragmentsForPaths($paths); | $indexes = $this->getFragmentIndexesForPaths($paths); | ||||
| $clauses[] = qsprintf( | $clauses[] = qsprintf( | ||||
| $conn, | $conn, | ||||
| '(rpath.repositoryPHID = %s AND rpath.path IN (%Ls))', | '(rpath.repositoryPHID = %s AND rpath.pathIndex IN (%Ls))', | ||||
| $repository_phid, | $repository_phid, | ||||
| $fragments); | $indexes); | ||||
| } | } | ||||
| $where[] = implode(' OR ', $clauses); | $where[] = implode(' OR ', $clauses); | ||||
| } | } | ||||
| return $where; | return $where; | ||||
| } | } | ||||
| protected function shouldGroupQueryResultRows() { | protected function shouldGroupQueryResultRows() { | ||||
| ▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | foreach ($paths as $path) { | ||||
| foreach (PhabricatorOwnersPackage::splitPath($path) as $fragment) { | foreach (PhabricatorOwnersPackage::splitPath($path) as $fragment) { | ||||
| $fragments[$fragment] = $fragment; | $fragments[$fragment] = $fragment; | ||||
| } | } | ||||
| } | } | ||||
| return $fragments; | return $fragments; | ||||
| } | } | ||||
| private function getFragmentIndexesForPaths(array $paths) { | |||||
| $indexes = array(); | |||||
| foreach ($this->getFragmentsForPaths($paths) as $fragment) { | |||||
| $indexes[] = PhabricatorHash::digestForIndex($fragment); | |||||
| } | |||||
| return $indexes; | |||||
| } | |||||
| /* -( Path Control )------------------------------------------------------- */ | /* -( Path Control )------------------------------------------------------- */ | ||||
| /** | /** | ||||
| * Get a list of all packages which control a path or its parent directories, | * Get a list of all packages which control a path or its parent directories, | ||||
| * ordered from weakest to strongest. | * ordered from weakest to strongest. | ||||
| * | * | ||||
| ▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines | |||||