r40885 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40884‎ | r40885 | r40886 >
Date:22:11, 15 September 2008
Author:siebrand
Status:old
Tags:
Comment:
Add credits, update main file header, and some other changes. Needs proper description.
Modified paths:
  • /trunk/extensions/CodeReview/CodeComment.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeRepository.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeReview.alias.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeReview.i18n.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeReview.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeRevision.php (modified) (history)
  • /trunk/extensions/CodeReview/SpecialCode.php (modified) (history)
  • /trunk/extensions/CodeReview/svnImport.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeRevision.php
@@ -76,12 +76,12 @@
7777 __METHOD__
7878 );
7979 }
80 -
 80+
8181 function saveComment( $text, $review, $parent=null ) {
8282 global $wgUser;
8383 $ts = wfTimestamp( TS_MW );
8484 $sortkey = $this->threadedSortkey( $parent, $ts );
85 -
 85+
8686 $dbw = wfGetDB( DB_SLAVE );
8787 $dbw->insert( 'code_comment',
8888 array(
@@ -96,7 +96,7 @@
9797 'cc_sortkey' => $sortkey ),
9898 __METHOD__ );
9999 }
100 -
 100+
101101 protected function threadedSortKey( $parent, $ts ) {
102102 if( $parent ) {
103103 // We construct a threaded sort key by concatenating the timestamps
@@ -116,7 +116,7 @@
117117 return $ts;
118118 }
119119 }
120 -
 120+
121121 function getComments() {
122122 $dbr = wfGetDB( DB_SLAVE );
123123 $result = $dbr->select( 'code_comment',
@@ -134,7 +134,7 @@
135135 __METHOD__,
136136 array(
137137 'ORDER BY' => 'cc_sortkey' ) );
138 -
 138+
139139 $comments = array();
140140 foreach( $result as $row ) {
141141 $comments[] = new CodeComment( $this, $row );
Index: trunk/extensions/CodeReview/CodeRepository.php
@@ -100,22 +100,22 @@
101101 throw new MWException( 'barf' );
102102 return CodeRevision::newFromRow( $row );
103103 }
104 -
 104+
105105 function getDiff( $rev ) {
106106 global $wgMemc;
107 -
 107+
108108 $rev1 = $rev - 1;
109109 $rev2 = $rev;
110 -
 110+
111111 $key = wfMemcKey( 'svn', md5( $this->mPath ), 'diff', $rev1, $rev2 );
112112 $data = $wgMemc->get( $key );
113 -
 113+
114114 if( !$data ) {
115115 $svn = SubversionAdaptor::newFromRepo( $this->mPath );
116116 $data = $svn->getDiff( '', $rev1, $rev2 );
117117 $wgMemc->add( $key, $data, 86400 );
118118 }
119 -
 119+
120120 return $data;
121121 }
122122 }
Index: trunk/extensions/CodeReview/CodeReview.i18n.php
@@ -10,6 +10,7 @@
1111
1212 $messages['en'] = array(
1313 'code' => 'Code Review',
 14+ 'code-desc' => 'This tells you what I do on Special:Version. Provide links to special page(s) if possible',
1415 'code-no-repo' => 'No repository configured!',
1516 'code-field-id' => 'Revision',
1617 'code-field-author' => 'Author',
Index: trunk/extensions/CodeReview/SpecialCode.php
@@ -43,7 +43,7 @@
4444 global $wgUser;
4545 $this->mSkin = $wgUser->getSkin();
4646 }
47 -
 47+
4848 abstract function execute();
4949
5050 function authorLink( $author ) {
@@ -93,7 +93,7 @@
9494 $this->mSkin = $wgUser->getSkin();
9595 $this->mRepo = $repo;
9696 }
97 -
 97+
9898 function link( $text ) {
9999 $text = preg_replace_callback( '/\br(\d+)\b/', array( $this, 'messageRevLink' ), $text );
100100 $text = preg_replace_callback( '/\bbug #?(\d+)\b/i', array( $this, 'messageBugLink' ), $text );
@@ -104,17 +104,17 @@
105105 $text = $arr[0];
106106 $bugNo = intval( $arr[1] );
107107 $url = $this->mRepo->getBugPath( $bugNo );
108 -
 108+
109109 return $this->makeExternalLink( $url, $text );
110110 }
111 -
 111+
112112 function messageRevLink( $matches ) {
113113 $text = $matches[0];
114114 $rev = intval( $matches[1] );
115 -
 115+
116116 $repo = $this->mRepo->getName();
117117 $title = SpecialPage::getTitleFor( 'Code', "$repo/$rev" );
118 -
 118+
119119 return $this->makeInternalLink( $title, $text );
120120 }
121121
@@ -124,7 +124,7 @@
125125 function makeExternalLink( $url, $text ) {
126126 return $this->mSkin->makeExternalLink( $url, $text );
127127 }
128 -
 128+
129129 function makeInternalLink( $title, $text ) {
130130 return $this->mSkin->link( $title, $text );
131131 }
@@ -134,7 +134,7 @@
135135 function makeExternalLink( $url, $text ) {
136136 return "[$url $text]";
137137 }
138 -
 138+
139139 function makeInternalLink( $title, $text ) {
140140 return "[[" . $title->getPrefixedText() . "|$text]]";
141141 }
@@ -216,7 +216,7 @@
217217 switch( $name ){
218218 case 'cr_id':
219219 global $wgUser;
220 - return $wgUser->getSkin()->link(
 220+ return $wgUser->getSkin()->link(
221221 SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/' . $value ), htmlspecialchars( $value )
222222 );
223223 case 'cr_author':
@@ -250,10 +250,10 @@
251251 $view->execute();
252252 return;
253253 }
254 -
 254+
255255 $this->checkPostings();
256 -
257 - $repoLink = $wgUser->getSkin()->link( SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() ),
 256+
 257+ $repoLink = $wgUser->getSkin()->link( SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() ),
258258 htmlspecialchars( $this->mRepo->getName() ) );
259259 $rev = $this->mRev->getId();
260260 $revText = htmlspecialchars( $rev );
@@ -283,13 +283,13 @@
284284 "<div class='mw-codereview-diff'>" .
285285 $this->formatDiff() .
286286 "</div>";
287 -
 287+
288288 $html .=
289289 "<h2>Comments</h2>" .
290290 $this->formatComments();
291291 $wgOut->addHtml( $html );
292292 }
293 -
 293+
294294 function checkPostings() {
295295 global $wgRequest, $wgUser;
296296 if( $wgRequest->wasPosted()
@@ -307,7 +307,7 @@
308308 }
309309 }
310310 }
311 -
 311+
312312 function formatPathLine( $path, $action ) {
313313 $desc = wfMsgHtml( 'code-rev-modified-'.strtolower( $action ) );
314314 $encPath = htmlspecialchars( $path );
@@ -323,12 +323,12 @@
324324 }
325325 return "<li>$link ($desc)</li>\n";
326326 }
327 -
 327+
328328 function formatDiff() {
329329 $diff = $this->mRepo->getDiff( $this->mRev->getId() );
330330 return "<pre>" . htmlspecialchars( $diff ) . "</pre>";
331331 }
332 -
 332+
333333 function formatComments() {
334334 return "<div class='mw-codereview-comments'>" .
335335 implode( "\n",
@@ -338,7 +338,7 @@
339339 $this->postCommentForm() .
340340 "</div>";
341341 }
342 -
 342+
343343 function formatComment( $comment ) {
344344 global $wgOut, $wgLang;
345345 $linker = new CodeCommentLinkerWiki( $this->mRepo );
@@ -355,7 +355,7 @@
356356 '</div>' .
357357 '</div>';
358358 }
359 -
 359+
360360 function postCommentForm( $parent=null ) {
361361 global $wgUser;
362362 return '<div class="mw-codereview-post-comment">' .
@@ -378,4 +378,4 @@
379379 '</div>' .
380380 '</form>';
381381 }
382 -}
\ No newline at end of file
 382+}
Index: trunk/extensions/CodeReview/CodeReview.php
@@ -1,11 +1,18 @@
22 <?php
33 if (!defined('MEDIAWIKI')) die();
44 /**
5 - * Copyright (c) 2008 Brion Vibber <brion@pobox.com>
6 - * GPLv2
 5+ *
 6+ * @author Brion Vibber
 7+ * @author Aaron Schulz
 8+ * @author Alexandre Emsenhuber
 9+ * @author Chad Horohoe
 10+ * @copyright Copyright � 2008 Brion Vibber <brion@pobox.com>
 11+ * @copyright Copyright � 2008 Chad Horohoe <innocentkiller@gmail.com>
 12+ * @copyright Copyright � 2008 Aaron Schulz <JSchulz_4587@msn.com>
 13+ * @copyright Copyright � 2008 Alexandre Emsenhuber <alex.emsenhuber@bluewin.ch>
 14+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
715 */
816
9 -
1017 /*
1118
1219 What do I need out of SVN?
@@ -20,6 +27,15 @@
2128
2229 */
2330
 31+$wgExtensionCredits['other'][] = array(
 32+ 'name' => 'CodeReview',
 33+ 'svn-date' => '$LastChangedDate$',
 34+ 'svn-revision' => '$LastChangedRevision$',
 35+ 'url' => 'http://www.mediawiki.org/wiki/Extension:CodeReview',
 36+ 'author' => array( 'Brion Vibber', 'Aaron Schulz', 'Alexandre Emsenhuber', 'Chad Horohoe' ),
 37+ 'descriptionmsg' => 'code-desc',
 38+);
 39+
2440 $dir = dirname(__FILE__) . '/';
2541
2642 $wgAutoloadClasses['CodeRepository'] = $dir . 'CodeRepository.php';
Property changes on: trunk/extensions/CodeReview/CodeReview.php
___________________________________________________________________
Added: svn:keywords
2743 + LastChangedDate LastChangedRevision
Index: trunk/extensions/CodeReview/CodeComment.php
@@ -1,4 +1,5 @@
22 <?php
 3+if (!defined('MEDIAWIKI')) die();
34
45 class CodeComment {
56 function __construct( $repo, $row ) {
@@ -10,4 +11,4 @@
1112 $this->timestamp = wfTimestamp( TS_MW, $row->cc_timestamp );
1213 $this->review = $row->cc_review;
1314 }
14 -}
\ No newline at end of file
 15+}
Index: trunk/extensions/CodeReview/svnImport.php
@@ -31,7 +31,7 @@
3232 while( $start <= $lastRev ) {
3333 $log = $svn->getLog( '', $start, $start + $chunkSize - 1 );
3434 if( empty($log) ) {
35 - # Repo seems to give a blank when max rev is invalid, which
 35+ # Repo seems to give a blank when max rev is invalid, which
3636 # stops new revisions from being added. Try to avoid this
3737 # by trying less at a time from the last point.
3838 if( $chunkSize <= 1 ) {
Index: trunk/extensions/CodeReview/CodeReview.alias.php
@@ -1,6 +1,6 @@
22 <?php
33 /**
4 - * Aliases for Special:AdvancedRandom
 4+ * Aliases for extension CodeReview
55 *
66 * @addtogroup Extensions
77 */

Status & tagging log