Merge "(bug 48521) Echo should not implicitly commit other transaction"

This commit is contained in:
jenkins-bot 2013-05-22 19:37:41 +00:00 committed by Gerrit Code Review
commit 021a9213be

View file

@ -10,24 +10,30 @@ class MWDbEchoBackend extends MWEchoBackend {
*/
public function createNotification( $row ) {
$dbw = MWEchoDbFactory::getDB( DB_MASTER );
$dbw->begin( __METHOD__ );
// reset the base if this notification has a display hash
if ( $row['notification_bundle_display_hash'] ) {
$dbw->update(
'echo_notification',
array( 'notification_bundle_base' => 0 ),
array(
'notification_user' => $row['notification_user'],
'notification_bundle_display_hash' => $row['notification_bundle_display_hash'],
'notification_bundle_base' => 1
),
__METHOD__
);
}
$row['notification_timestamp'] = $dbw->timestamp( $row['notification_timestamp'] );
$dbw->insert( 'echo_notification', $row, __METHOD__ );
$dbw->commit( __METHOD__ );
$fname = __METHOD__;
$dbw->onTransactionIdle(
function() use ( $dbw, $row, $fname ) {
$dbw->begin( $fname );
// reset the base if this notification has a display hash
if ( $row['notification_bundle_display_hash'] ) {
$dbw->update(
'echo_notification',
array( 'notification_bundle_base' => 0 ),
array(
'notification_user' => $row['notification_user'],
'notification_bundle_display_hash' => $row['notification_bundle_display_hash'],
'notification_bundle_base' => 1
),
$fname
);
}
$row['notification_timestamp'] = $dbw->timestamp( $row['notification_timestamp'] );
$dbw->insert( 'echo_notification', $row, $fname );
$dbw->commit( $fname );
}
);
}
/**