private function generate() { wfProfileIn(__METHOD__); $dbr = wfGetDB(DB_SLAVE); $this->revisions = $dbr->selectField('code_rev', 'COUNT(*)', array('cr_repo_id' => $this->repo->getId()), __METHOD__); $this->authors = $dbr->selectField('code_rev', 'COUNT(DISTINCT cr_author)', array('cr_repo_id' => $this->repo->getId()), __METHOD__); $this->states = array(); $res = $dbr->select('code_rev', array('cr_status', 'COUNT(*) AS revs'), array('cr_repo_id' => $this->repo->getId()), __METHOD__, array('GROUP BY' => 'cr_status')); foreach ($res as $row) { $this->states[$row->cr_status] = $row->revs; } $repoName = $this->repo->getName(); $this->fixmes = $this->getAuthorStatusCounts('fixme'); $this->new = $this->getAuthorStatusCounts('new'); $this->fixmesPerPath = array(); global $wgCodeReviewFixmePerPath; if (isset($wgCodeReviewFixmePerPath[$repoName])) { foreach ($wgCodeReviewFixmePerPath[$repoName] as $path) { $this->fixmesPerPath[$path] = $this->getPathFixmes($path); } } $this->newPerPath = array(); global $wgCodeReviewNewPerPath; if (isset($wgCodeReviewNewPerPath[$repoName])) { foreach ($wgCodeReviewNewPerPath[$repoName] as $path) { $this->newPerPath[$path] = $this->getPathNews($path); } } wfProfileOut(__METHOD__); }
/** * @param $matches array */ function messageRevLink($matches) { $text = $matches[0]; $rev = intval($matches[1]); $repo = $this->mRepo->getName(); $title = SpecialPage::getTitleFor('Code', "{$repo}/{$rev}"); return $this->makeInternalLink($title, $text); }
/** * @param $status string * @param $oldStatus string */ protected function sendStatusToUDP($status, $oldStatus) { global $wgCodeReviewUDPAddress, $wgCodeReviewUDPPort, $wgCodeReviewUDPPrefix, $wgUser; if ($wgCodeReviewUDPAddress) { $url = $this->getCanonicalUrl(); $line = wfMsg('code-rev-status') . " 14(" . $this->repo->getName() . ")03 " . RecentChange::cleanupForIRC($wgUser->getName()) . " " . str_replace("'''", '', wfMsg('code-change-status', "7" . $this->getIdString() . "")) . ": 15" . wfMsg('code-status-' . $oldStatus) . " -> 10" . wfMsg('code-status-' . $status) . " " . $url; RecentChange::sendToUDP($line, $wgCodeReviewUDPAddress, $wgCodeReviewUDPPrefix, $wgCodeReviewUDPPort); } }
/** * @param $pager SvnTablePager * * @return string */ function showForm($pager) { global $wgScript, $wgRequest; $states = CodeRevision::getPossibleStates(); $name = $this->mRepo->getName(); $title = SpecialPage::getTitleFor('Code', $name); $options = array(Xml::option('', $title->getPrefixedText(), $this->mStatus == '')); foreach ($states as $key => $state) { $title = SpecialPage::getTitleFor('Code', $name . "/status/{$state}"); $options[] = Xml::option(wfMsgHtml("code-status-{$state}"), $title->getPrefixedText(), $this->mStatus == $state); } $ret = "<fieldset><legend>" . wfMsgHtml('code-pathsearch-legend') . "</legend>" . '<table width="100%"><tr><td>' . Xml::openElement('form', array('action' => $wgScript, 'method' => 'get')) . Xml::inputlabel(wfMsg("code-pathsearch-path"), 'path', 'path', 55, $this->getPathsAsString(), array('dir' => 'ltr')) . ' ' . Xml::label(wfMsg('code-pathsearch-filter'), 'code-status-filter') . ' ' . Xml::openElement('select', array('id' => 'code-status-filter', 'name' => 'title')) . "\n" . implode("\n", $options) . "\n" . Xml::closeElement('select') . ' ' . Xml::submitButton(wfMsg('allpagessubmit')) . $pager->getHiddenFields(array('path', 'title')) . Xml::closeElement('form') . '</td></tr></table></fieldset>'; return $ret; }
function authorLink($author, $extraParams = array()) { $repo = $this->mRepo->getName(); $special = SpecialPage::getTitleFor('Code', "{$repo}/author/{$author}"); return $this->skin->link($special, htmlspecialchars($author), array(), $extraParams); }