- if ( $this->mAttribs['rc_type'] != RC_CATEGORIZE ) {
- if ( Hooks::run( 'AbortEmailNotification', [ $editor, $title, $this ] ) ) {
- # @todo FIXME: This would be better as an extension hook
- $enotif = new EmailNotification();
- $enotif->notifyOnPageChange(
- $editor,
- $title,
- $this->mAttribs['rc_timestamp'],
- $this->mAttribs['rc_comment'],
- $this->mAttribs['rc_minor'],
- $this->mAttribs['rc_last_oldid'],
- $this->mExtra['pageStatus']
- );
- }
+ 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,
+ $title,
+ $this->mAttribs['rc_timestamp'],
+ $this->mAttribs['rc_comment'],
+ $this->mAttribs['rc_minor'],
+ $this->mAttribs['rc_last_oldid'],
+ $this->mExtra['pageStatus']
+ );
+ },
+ __METHOD__
+ );