From d4877cc3ad2592043d7ab2ece24e5f86ba7b6378 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 14 May 2013 18:36:07 -0700 Subject: [PATCH] Hide exceptions in MediaWiki::doJobs() as deferred updates do. Change-Id: Ia83029d4c06bf3f2be6ad0797e815464e44fd088 --- includes/Wiki.php | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/includes/Wiki.php b/includes/Wiki.php index 3f7e19cf97..cb0f60ac52 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -624,27 +624,34 @@ class MediaWiki { wfShellExec( "$cmd &", $retVal ); wfProfileOut( __METHOD__ . '-exec' ); } else { - // Fallback to running the jobs here while the user waits - $group = JobQueueGroup::singleton(); - do { - $job = $group->pop( JobQueueGroup::USE_CACHE ); // job from any queue - if ( $job ) { - $output = $job->toString() . "\n"; - $t = - microtime( true ); - wfProfileIn( __METHOD__ . '-' . get_class( $job ) ); - $success = $job->run(); - wfProfileOut( __METHOD__ . '-' . get_class( $job ) ); - $group->ack( $job ); // done - $t += microtime( true ); - $t = round( $t * 1000 ); - if ( $success === false ) { - $output .= "Error: " . $job->getLastError() . ", Time: $t ms\n"; - } else { - $output .= "Success, Time: $t ms\n"; + try { + // Fallback to running the jobs here while the user waits + $group = JobQueueGroup::singleton(); + do { + $job = $group->pop( JobQueueGroup::USE_CACHE ); // job from any queue + if ( $job ) { + $output = $job->toString() . "\n"; + $t = - microtime( true ); + wfProfileIn( __METHOD__ . '-' . get_class( $job ) ); + $success = $job->run(); + wfProfileOut( __METHOD__ . '-' . get_class( $job ) ); + $group->ack( $job ); // done + $t += microtime( true ); + $t = round( $t * 1000 ); + if ( $success === false ) { + $output .= "Error: " . $job->getLastError() . ", Time: $t ms\n"; + } else { + $output .= "Success, Time: $t ms\n"; + } + wfDebugLog( 'jobqueue', $output ); } - wfDebugLog( 'jobqueue', $output ); - } - } while ( --$n && $job ); + } while ( --$n && $job ); + } catch ( MWException $e ) { + // We don't want exceptions thrown during job execution to + // be reported to the user since the output is already sent. + // Instead we just log them. + wfDebugLog( 'exception', $e->getLogMessage() ); + } } } } -- 2.20.1