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

Fix Owners package specificity ordering

Summary: This algorithm isn't quite right with respect to ordering more-specific packages correctly.

Test Plan: {F729864}

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D13929
This commit is contained in:
epriestley 2015-08-18 12:12:51 -07:00
parent 13346ea904
commit 0a509ea7ec

View file

@ -230,16 +230,19 @@ final class PhabricatorOwnersPackage
} }
public static function splitPath($path) { public static function splitPath($path) {
$result = array('/');
$trailing_slash = preg_match('@/$@', $path) ? '/' : ''; $trailing_slash = preg_match('@/$@', $path) ? '/' : '';
$path = trim($path, '/'); $path = trim($path, '/');
$parts = explode('/', $path); $parts = explode('/', $path);
$result = array();
while (count($parts)) { while (count($parts)) {
$result[] = '/'.implode('/', $parts).$trailing_slash; $result[] = '/'.implode('/', $parts).$trailing_slash;
$trailing_slash = '/'; $trailing_slash = '/';
array_pop($parts); array_pop($parts);
} }
return $result; $result[] = '/';
return array_reverse($result);
} }
public function attachPaths(array $paths) { public function attachPaths(array $paths) {