r95431 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95430‎ | r95431 | r95432 >
Date:19:53, 24 August 2011
Author:hashar
Status:ok
Tags:
Comment:
ability to create comment from a DB id (and a rev)
Modified paths:
  • /trunk/extensions/CodeReview/backend/CodeComment.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeComment.php
@@ -28,6 +28,36 @@
2929 }
3030
3131 /**
 32+ * Create a comment given its id AND a repository
 33+ * @param int $cc_id Comment ID in the database
 34+ * @param CodeRevision $rev A revision object to which the comment is
 35+ * attached
 36+ */
 37+ static function newFromID( $cc_id, CodeRevision $rev ) {
 38+ $dbr = wfGetDB( DB_SLAVE );
 39+ $row = $dbr->selectRow( 'code_comment',
 40+ array(
 41+ # fields needed to build a CodeRevision
 42+ 'cc_rev_id',
 43+ 'cc_repo_id',
 44+
 45+ # fields needed for self::newFromRow()
 46+ 'cc_id',
 47+ 'cc_text',
 48+ 'cc_user',
 49+ 'cc_user_text',
 50+ 'cc_patch_line',
 51+ 'cc_timestamp',
 52+ 'cc_review',
 53+ 'cc_sortkey'
 54+ ),
 55+ array( 'cc_id' => (int) $cc_id ),
 56+ __METHOD__
 57+ );
 58+ return self::newFromRow( $rev, $row );
 59+ }
 60+
 61+ /**
3262 * @param $rev Revision
3363 * @param $data array
3464 * @return CodeComment

Status & tagging log