r79382 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79381‎ | r79382 | r79383 >
Date:23:21, 31 December 2010
Author:reedy
Status:ok
Tags:
Comment:
Refactor out code added in r79379 so it can be reused in a maintenance script
Modified paths:
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -22,7 +22,6 @@
2323 $rev->mOldStatus = '';
2424
2525 $common = null;
26 - $allPaths = array();
2726 if ( $rev->mPaths ) {
2827 if ( count( $rev->mPaths ) == 1 ) {
2928 $common = $rev->mPaths[0]['path'];
@@ -48,26 +47,15 @@
4948 }
5049 }
5150 $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 - }
6451 }
6552 $common = implode( '/', $common );
6653
 54+ $rev->mPaths = CodeRevision::getPathFragments( $rev->mPaths );
 55+
6756 array_unshift( $rev->mPaths, $first );
6857 }
6958 }
7059 $rev->mCommonPath = $common;
71 - $rev->mPaths = $allPaths;
7260
7361 // Check for ignored paths
7462 global $wgCodeReviewDeferredPaths;
@@ -84,6 +72,28 @@
8573
8674 /**
8775 * @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
8898 * @throws MWException
8999 * @param CodeRepository $repo
90100 * @param $row

Follow-up revisions

RevisionCommit summaryAuthorDate
r79385Fix renaming fail from r79382reedy23:37, 31 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79379*(bug 23720) CodeReview doesn't show ancient revisions for a path...reedy22:55, 31 December 2010

Status & tagging log