Such exceptions should not reported to the user because the main output
is already sent. Otherwise the user will recive a double reponse with
is just horribly looking. Instead just log these exceptions to keep a
trace of them. This also adds an higher isolation level for these
updates and the post-response cleanup.
Change-Id: I60c2c5ba8ab2ec2d835d8d3042584e98a62809be
}
foreach ( $updates as $update ) {
- $update->doUpdate();
+ try {
+ $update->doUpdate();
- if ( $doCommit && $dbw->trxLevel() ) {
- $dbw->commit( __METHOD__ );
+ if ( $doCommit && $dbw->trxLevel() ) {
+ $dbw->commit( __METHOD__ );
+ }
+ } catch ( MWException $e ) {
+ // We don't want exceptions thrown during deferred updates to
+ // be reported to the user since the output is already sent.
+ // Instead we just log them.
+ if ( !$e instanceof ErrorPageError ) {
+ wfDebugLog( 'exception', $e->getLogMessage() );
+ }
}
}