From: Aaron Schulz Date: Mon, 12 Sep 2016 21:23:14 +0000 (-0700) Subject: Make sure emails from RecentChange::save() are for comitted rows X-Git-Tag: 1.31.0-rc.0~5601^2 X-Git-Url: https://git.heureux-cyclage.org/w/index.php?a=commitdiff_plain;h=047b90e7443584ca71220784a4dcef55e8694856;p=lhc%2Fweb%2Fwiklou.git Make sure emails from RecentChange::save() are for comitted rows Change-Id: I9086a70348d2f0843527e3805e9f6aef3356ee03 --- diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index a5d1fc5f71..8e74674845 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -336,9 +336,13 @@ class RecentChange { $title = $this->getTitle(); // Never send an RC notification email about categorization changes - if ( $this->mAttribs['rc_type'] != RC_CATEGORIZE ) { - if ( Hooks::run( 'AbortEmailNotification', [ $editor, $title, $this ] ) ) { - # @todo FIXME: This would be better as an extension hook + if ( + $this->mAttribs['rc_type'] != RC_CATEGORIZE && + Hooks::run( 'AbortEmailNotification', [ $editor, $title, $this ] ) + ) { + // @FIXME: This would be better as an extension hook + // Send emails or email jobs once this row is safely committed + $dbw->onTransactionIdle( function () use ( $editor, $title ) { $enotif = new EmailNotification(); $enotif->notifyOnPageChange( $editor, @@ -349,7 +353,7 @@ class RecentChange { $this->mAttribs['rc_last_oldid'], $this->mExtra['pageStatus'] ); - } + } ); } }