r48793 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48792‎ | r48793 | r48794 >
Date:08:33, 25 March 2009
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
populate code_relations table
Modified paths:
  • /trunk/extensions/CodeReview/CodeRevision.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeRevision.php
@@ -180,12 +180,22 @@
181181 'cp_path' => $path['path'],
182182 'cp_action' => $path['action'] );
183183 }
184 - $dbw->insert( 'code_paths',
185 - $data,
186 - __METHOD__,
187 - array( 'IGNORE' ) );
 184+ $dbw->insert( 'code_paths', $data, __METHOD__, array( 'IGNORE' ) );
188185 }
189 -
 186+ // Update code relations (One-digit revs skipped due to some false-positives)
 187+ if ( preg_match( '/\br(\d{2,})\b/', $this->mMessage, $m ) ) {
 188+ $data = array();
 189+ unset($m[0]); // ignore the whole match
 190+ foreach( $m as $rev ) {
 191+ $data[] = array(
 192+ 'cf_repo_id' => $this->mRepoId,
 193+ 'cf_from' => $this->mId,
 194+ 'cf_to' => intval($rev)
 195+ );
 196+ }
 197+ $dbw->insert( 'code_relations', $data, __METHOD__, array( 'IGNORE' ) );
 198+ }
 199+
190200 $dbw->commit();
191201 }
192202

Comments

#Comment by Brion VIBBER (talk | contribs)   11:48, 25 March 2009

This will only catch the first reference to a previous revision. Need to use preg_match_all() to catch em all.

#Comment by Aaron Schulz (talk | contribs)   14:01, 25 March 2009

Fixed in r48818

Status & tagging log