r90148 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90147‎ | r90148 | r90149 >
Date:20:44, 15 June 2011
Author:reedy
Status:ok
Tags:
Comment:
Refactor out code for getting number of revisions each author has for a certain status

Add saving of list of new revisions
Modified paths:
  • /trunk/extensions/CodeReview/backend/RepoStats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/RepoStats.php
@@ -13,7 +13,8 @@
1414 public $revisions,
1515 $authors,
1616 $states,
17 - $fixmes;
 17+ $fixmes,
 18+ $new;
1819
1920 /**
2021 * @param CodeRepository $repo
@@ -71,10 +72,22 @@
7273 $this->states[$row->cr_status] = $row->revs;
7374 }
7475
75 - $this->fixmes = array();
 76+ $this->fixmes = $this->getAuthorStatusCounts( 'fixme' );
 77+ $this->new = $this->getAuthorStatusCounts( 'new' );
 78+
 79+ wfProfileOut( __METHOD__ );
 80+ }
 81+
 82+ /**
 83+ * @param $status string
 84+ *
 85+ * @return array
 86+ */
 87+ private function getAuthorStatusCounts( $status ) {
 88+ $array = array();
7689 $res = $dbr->select( 'code_rev',
7790 array( 'COUNT(*) AS revs', 'cr_author' ),
78 - array( 'cr_repo_id' => $this->repo->getId(), 'cr_status' => 'fixme' ),
 91+ array( 'cr_repo_id' => $this->repo->getId(), 'cr_status' => $status ),
7992 __METHOD__,
8093 array(
8194 'GROUP BY' => 'cr_author',
@@ -83,9 +96,8 @@
8497 )
8598 );
8699 foreach ( $res as $row ) {
87 - $this->fixmes[$row->cr_author] = $row->revs;
 100+ $array[$row->cr_author] = $row->revs;
88101 }
89 -
90 - wfProfileOut( __METHOD__ );
 102+ return $array;
91103 }
92104 }
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r90149Add list of new revisions per author like the fixme breakdownreedy20:49, 15 June 2011
r90159Define $dbr in r90148reedy21:17, 15 June 2011

Status & tagging log