Changeset View
Changeset View
Standalone View
Standalone View
src/applications/owners/query/PhabricatorOwnersPackageQuery.php
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | if ($this->needPaths) { | ||||
$paths = mgroup($paths, 'getPackageID'); | $paths = mgroup($paths, 'getPackageID'); | ||||
foreach ($packages as $package) { | foreach ($packages as $package) { | ||||
$package->attachPaths(idx($paths, $package->getID(), array())); | $package->attachPaths(idx($paths, $package->getID(), array())); | ||||
} | } | ||||
} | } | ||||
if ($this->controlMap) { | if ($this->controlMap) { | ||||
$this->controlResults += mpull($packages, null, 'getID'); | foreach ($packages as $package) { | ||||
// If this package is archived, it's no longer a controlling package | |||||
// for any path. In particular, it can not force active packages with | |||||
// weak dominion to give up control. | |||||
if ($package->isArchived()) { | |||||
continue; | |||||
} | |||||
$this->controlResults[$package->getID()] = $package; | |||||
} | |||||
} | } | ||||
return $packages; | return $packages; | ||||
} | } | ||||
protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) { | protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) { | ||||
$joins = parent::buildJoinClauseParts($conn); | $joins = parent::buildJoinClauseParts($conn); | ||||
▲ Show 20 Lines • Show All 215 Lines • ▼ Show 20 Lines | public function getControllingPackagesForPath($repository_phid, $path) { | ||||
$path_fragments = PhabricatorOwnersPackage::splitPath($path); | $path_fragments = PhabricatorOwnersPackage::splitPath($path); | ||||
$fragment_count = count($path_fragments); | $fragment_count = count($path_fragments); | ||||
$matches = array(); | $matches = array(); | ||||
foreach ($packages as $package_id => $package) { | foreach ($packages as $package_id => $package) { | ||||
$best_match = null; | $best_match = null; | ||||
$include = false; | $include = false; | ||||
// If this package is archived, it's no longer a controlling package | |||||
// for the given path. In particular, it can not force active packages | |||||
// with weak dominion to give up control. | |||||
if ($package->isArchived()) { | |||||
continue; | |||||
} | |||||
$repository_paths = $package->getPathsForRepository($repository_phid); | $repository_paths = $package->getPathsForRepository($repository_phid); | ||||
foreach ($repository_paths as $package_path) { | foreach ($repository_paths as $package_path) { | ||||
$strength = $package_path->getPathMatchStrength( | $strength = $package_path->getPathMatchStrength( | ||||
$path_fragments, | $path_fragments, | ||||
$fragment_count); | $fragment_count); | ||||
if ($strength > $best_match) { | if ($strength > $best_match) { | ||||
$best_match = $strength; | $best_match = $strength; | ||||
$include = !$package_path->getExcluded(); | $include = !$package_path->getExcluded(); | ||||
Show All 31 Lines |