r105945 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105944‎ | r105945 | r105946 >
Date:22:43, 12 December 2011
Author:reedy
Status:ok
Tags:
Comment:
Refactor out duplicate code

Add documentation
Modified paths:
  • /trunk/extensions/CodeReview/CodeReview.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRepoStatsView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeReview.php
@@ -228,6 +228,8 @@
229229 * Any base paths matching regular expressions in these arrays will have their
230230 * default status set to deferred instead of new. Helpful if you've got a part
231231 * of the repository you don't care about.
 232+ *
 233+ * $wgCodeReviewDeferredPaths = array( 'RepoName' => array( '/path/to/use', '/another/path/to/use' ) )
232234 */
233235 $wgCodeReviewDeferredPaths = array();
234236
Index: trunk/extensions/CodeReview/ui/CodeRepoStatsView.php
@@ -30,7 +30,7 @@
3131 foreach ( CodeRevision::getPossibleStates() as $state ) {
3232 $count = isset( $stats->states[$state] ) ? $stats->states[$state] : 0;
3333 $count = htmlspecialchars( $wgLang->formatNum( $count ) );
34 - $link = $this->skin->link(
 34+ $link = Linker::link(
3535 SpecialPage::getTitleFor( 'Code', $repoName . '/status/' . $state ),
3636 htmlspecialchars( $this->statusDesc( $state ) )
3737 );
@@ -49,21 +49,26 @@
5050 }
5151
5252 if ( !empty( $stats->fixmesPerPath ) ) {
53 - $wgOut->wrapWikiMsg( "<h3 id=\"stats-fixme-path\">$1</h3>", 'code-stats-fixme-breakdown-path' );
54 -
55 - foreach ( $stats->fixmesPerPath as $path => $fixmes ) {
56 - $wgOut->wrapWikiMsg( "<h4 id=\"stats-fixme-path\">$1</h4>", array( 'code-stats-fixme-path', $path ) );
57 - $this->writeAuthorTable( 'fixme', $fixmes, array( 'path' => $path ) );
58 - }
 53+ $this->writeStatusPathTable( 'fixme', $stats->fixmesPerPath );
5954 }
6055
6156 if ( !empty( $stats->newPerPath ) ) {
62 - $wgOut->wrapWikiMsg( "<h3 id=\"stats-new-path\">$1</h3>", 'code-stats-new-breakdown-path' );
 57+ $this->writeStatusPathTable( 'new', $stats->newPerPath );
 58+ }
 59+ }
6360
64 - foreach ( $stats->newPerPath as $path => $news ) {
65 - $wgOut->wrapWikiMsg( "<h4 id=\"stats-new-path\">$1</h4>", array( 'code-stats-new-path', $path ) );
66 - $this->writeAuthorTable( 'fixme', $news, array( 'path' => $path ) );
67 - }
 61+ /**
 62+ * @param $status string
 63+ * @param $array array
 64+ */
 65+ function writeStatusPathTable( $status, $array ) {
 66+ global $wgOut;
 67+
 68+ $wgOut->wrapWikiMsg( "<h3 id=\"stats-$status-path\">$1</h3>", "code-stats-$status-breakdown-path" );
 69+
 70+ foreach ( $array as $path => $news ) {
 71+ $wgOut->wrapWikiMsg( "<h4 id=\"stats-$status-path\">$1</h4>", array( "code-stats-$status-path", $path ) );
 72+ $this->writeAuthorTable( $status, $news, array( 'path' => $path ) );
6873 }
6974 }
7075
@@ -93,7 +98,7 @@
9499
95100 foreach ( $array as $user => $count ) {
96101 $count = htmlspecialchars( $wgLang->formatNum( $count ) );
97 - $link = $this->skin->link(
 102+ $link = Linker::link(
98103 $title,
99104 htmlspecialchars( $user ),
100105 array(),

Status & tagging log