Index: trunk/extensions/CodeReview/backend/CodeRevision.php |
— | — | @@ -213,6 +213,7 @@ |
214 | 214 | __METHOD__, |
215 | 215 | array( 'IGNORE' ) |
216 | 216 | ); |
| 217 | + |
217 | 218 | // Already exists? Update the row! |
218 | 219 | $newRevision = $dbw->affectedRows() > 0; |
219 | 220 | if ( !$newRevision ) { |
— | — | @@ -228,6 +229,7 @@ |
229 | 230 | __METHOD__ |
230 | 231 | ); |
231 | 232 | } |
| 233 | + |
232 | 234 | // Update path tracking used for output and searching |
233 | 235 | if ( $this->mPaths ) { |
234 | 236 | $data = array(); |
— | — | @@ -240,6 +242,7 @@ |
241 | 243 | } |
242 | 244 | $this->insertChunks( $dbw, 'code_paths', $data, __METHOD__, array( 'IGNORE' ) ); |
243 | 245 | } |
| 246 | + |
244 | 247 | // Update bug references table... |
245 | 248 | $affectedBugs = array(); |
246 | 249 | if ( preg_match_all( '/\bbug (\d+)\b/', $this->mMessage, $m ) ) { |
— | — | @@ -254,6 +257,7 @@ |
255 | 258 | } |
256 | 259 | $dbw->insert( 'code_bugs', $data, __METHOD__, array( 'IGNORE' ) ); |
257 | 260 | } |
| 261 | + |
258 | 262 | // Get the revisions this commit references... |
259 | 263 | $affectedRevs = array(); |
260 | 264 | if ( preg_match_all( '/\br(\d{2,})\b/', $this->mMessage, $m ) ) { |
— | — | @@ -264,6 +268,7 @@ |
265 | 269 | } |
266 | 270 | } |
267 | 271 | } |
| 272 | + |
268 | 273 | // Also, get previous revisions that have bugs in common... |
269 | 274 | if ( count( $affectedBugs ) ) { |
270 | 275 | $res = $dbw->select( 'code_bugs', |
— | — | @@ -280,6 +285,7 @@ |
281 | 286 | $affectedRevs[] = intval( $row->cb_from ); |
282 | 287 | } |
283 | 288 | } |
| 289 | + |
284 | 290 | // Filter any duplicate revisions |
285 | 291 | if ( count( $affectedRevs ) ) { |
286 | 292 | $data = array(); |
— | — | @@ -294,8 +300,10 @@ |
295 | 301 | } |
296 | 302 | $dbw->insert( 'code_relations', $data, __METHOD__, array( 'IGNORE' ) ); |
297 | 303 | } |
| 304 | + |
| 305 | + global $wgEnableEmail; |
298 | 306 | // Email the authors of revisions that this follows up on |
299 | | - if ( $newRevision && count( $affectedRevs ) > 0 ) { |
| 307 | + if ( $wgEnableEmail && $newRevision && count( $affectedRevs ) > 0 ) { |
300 | 308 | // Get committer wiki user name, or repo name at least |
301 | 309 | $user = $this->mRepo->authorWikiUser( $this->mAuthor ); |
302 | 310 | $committer = $user ? $user->getName() : htmlspecialchars( $this->mAuthor ); |
— | — | @@ -312,6 +320,7 @@ |
313 | 321 | __METHOD__, |
314 | 322 | array( 'USE INDEX' => 'PRIMARY' ) |
315 | 323 | ); |
| 324 | + |
316 | 325 | // Get repo and build comment title (for url) |
317 | 326 | $title = SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/' . $this->mId ); |
318 | 327 | $url = $title->getFullUrl(); |
— | — | @@ -322,6 +331,7 @@ |
323 | 332 | if ( !$user || !$user->canReceiveEmail() ) { |
324 | 333 | continue; |
325 | 334 | } |
| 335 | + |
326 | 336 | // Send message in receiver's language |
327 | 337 | $lang = array( 'language' => $user->getOption( 'language' ) ); |
328 | 338 | $user->sendMail( |