r70578 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70577‎ | r70578 | r70579 >
Date:18:35, 6 August 2010
Author:reedy
Status:ok
Tags:
Comment:
CodeReview should only attempt to send emails about followup revisions if wgEnableEmail = true

Add some blank lines
Modified paths:
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -213,6 +213,7 @@
214214 __METHOD__,
215215 array( 'IGNORE' )
216216 );
 217+
217218 // Already exists? Update the row!
218219 $newRevision = $dbw->affectedRows() > 0;
219220 if ( !$newRevision ) {
@@ -228,6 +229,7 @@
229230 __METHOD__
230231 );
231232 }
 233+
232234 // Update path tracking used for output and searching
233235 if ( $this->mPaths ) {
234236 $data = array();
@@ -240,6 +242,7 @@
241243 }
242244 $this->insertChunks( $dbw, 'code_paths', $data, __METHOD__, array( 'IGNORE' ) );
243245 }
 246+
244247 // Update bug references table...
245248 $affectedBugs = array();
246249 if ( preg_match_all( '/\bbug (\d+)\b/', $this->mMessage, $m ) ) {
@@ -254,6 +257,7 @@
255258 }
256259 $dbw->insert( 'code_bugs', $data, __METHOD__, array( 'IGNORE' ) );
257260 }
 261+
258262 // Get the revisions this commit references...
259263 $affectedRevs = array();
260264 if ( preg_match_all( '/\br(\d{2,})\b/', $this->mMessage, $m ) ) {
@@ -264,6 +268,7 @@
265269 }
266270 }
267271 }
 272+
268273 // Also, get previous revisions that have bugs in common...
269274 if ( count( $affectedBugs ) ) {
270275 $res = $dbw->select( 'code_bugs',
@@ -280,6 +285,7 @@
281286 $affectedRevs[] = intval( $row->cb_from );
282287 }
283288 }
 289+
284290 // Filter any duplicate revisions
285291 if ( count( $affectedRevs ) ) {
286292 $data = array();
@@ -294,8 +300,10 @@
295301 }
296302 $dbw->insert( 'code_relations', $data, __METHOD__, array( 'IGNORE' ) );
297303 }
 304+
 305+ global $wgEnableEmail;
298306 // Email the authors of revisions that this follows up on
299 - if ( $newRevision && count( $affectedRevs ) > 0 ) {
 307+ if ( $wgEnableEmail && $newRevision && count( $affectedRevs ) > 0 ) {
300308 // Get committer wiki user name, or repo name at least
301309 $user = $this->mRepo->authorWikiUser( $this->mAuthor );
302310 $committer = $user ? $user->getName() : htmlspecialchars( $this->mAuthor );
@@ -312,6 +320,7 @@
313321 __METHOD__,
314322 array( 'USE INDEX' => 'PRIMARY' )
315323 );
 324+
316325 // Get repo and build comment title (for url)
317326 $title = SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/' . $this->mId );
318327 $url = $title->getFullUrl();
@@ -322,6 +331,7 @@
323332 if ( !$user || !$user->canReceiveEmail() ) {
324333 continue;
325334 }
 335+
326336 // Send message in receiver's language
327337 $lang = array( 'language' => $user->getOption( 'language' ) );
328338 $user->sendMail(

Status & tagging log