Index: trunk/extensions/CodeReview/backend/CodeRevision.php |
— | — | @@ -22,7 +22,6 @@ |
23 | 23 | $rev->mOldStatus = ''; |
24 | 24 | |
25 | 25 | $common = null; |
26 | | - $allPaths = array(); |
27 | 26 | if ( $rev->mPaths ) { |
28 | 27 | if ( count( $rev->mPaths ) == 1 ) { |
29 | 28 | $common = $rev->mPaths[0]['path']; |
— | — | @@ -48,26 +47,15 @@ |
49 | 48 | } |
50 | 49 | } |
51 | 50 | $common = $tmp; |
52 | | - |
53 | | - $path = "/"; |
54 | | - foreach( $compare as $partPath ) { |
55 | | - |
56 | | - if ( $path !== "/" ) { |
57 | | - $path .= '/'; |
58 | | - } |
59 | | - |
60 | | - $path .= $partPath; |
61 | | - |
62 | | - $allPaths[] = $path; |
63 | | - } |
64 | 51 | } |
65 | 52 | $common = implode( '/', $common ); |
66 | 53 | |
| 54 | + $rev->mPaths = CodeRevision::getPathFragments( $rev->mPaths ); |
| 55 | + |
67 | 56 | array_unshift( $rev->mPaths, $first ); |
68 | 57 | } |
69 | 58 | } |
70 | 59 | $rev->mCommonPath = $common; |
71 | | - $rev->mPaths = $allPaths; |
72 | 60 | |
73 | 61 | // Check for ignored paths |
74 | 62 | global $wgCodeReviewDeferredPaths; |
— | — | @@ -84,6 +72,28 @@ |
85 | 73 | |
86 | 74 | /** |
87 | 75 | * @static |
| 76 | + * @param array $paths |
| 77 | + * @return array |
| 78 | + */ |
| 79 | + public static function getPathFragments( $paths = array() ) { |
| 80 | + $allPaths = array(); |
| 81 | + $path = "/"; |
| 82 | + foreach( $compare as $partPath ) { |
| 83 | + |
| 84 | + if ( $path !== "/" ) { |
| 85 | + $path .= '/'; |
| 86 | + } |
| 87 | + |
| 88 | + $path .= $partPath; |
| 89 | + |
| 90 | + $allPaths[] = $path; |
| 91 | + } |
| 92 | + |
| 93 | + return array_unique( $allPaths ); |
| 94 | + } |
| 95 | + |
| 96 | + /** |
| 97 | + * @static |
88 | 98 | * @throws MWException |
89 | 99 | * @param CodeRepository $repo |
90 | 100 | * @param $row |