r56536 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56535‎ | r56536 | r56537 >
Date:16:31, 17 September 2009
Author:aaron
Status:deferred
Tags:
Comment:
Add more error catching
Modified paths:
  • /trunk/extensions/ReaderFeedback/specialpages/RatingHistory_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ReaderFeedback/specialpages/RatingHistory_body.php
@@ -474,19 +474,28 @@
475475 # Create the graph
476476 @$plot->init();
477477 $plot->drawGraph();
478 - $plot->polyLine('dave');
479 - $plot->polyLine('rave');
 478+ if( !$plot->polyLine('dave') ) {
 479+ throw new MWException( 'Could not generate "dave" line!' );
 480+ }
 481+ if( !$plot->polyLine('rave') ) {
 482+ throw new MWException( 'Could not generate "rave" line!' );
 483+ }
 484+ if( !$plot->polyLine('dcount') ) {
 485+ throw new MWException( 'Could not generate "dcount" line!' );
 486+ }
480487 #$plot->line('dcount');
481 - $plot->polyLine('dcount');
482488 // Render!
483489 $plot->generateSVG( "xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'" );
484490 // Write to file for cache
485491 $svgPath = $this->getFilePath( $tag, 'svg' );
486492 $svgHandler = new SvgHandler();
487 - if( @!file_put_contents( $svgPath, $plot->svg ) ) {
 493+ wfSuppressWarnings(); // FS notices possible
 494+ if( !file_put_contents( $svgPath, $plot->svg ) ) {
488495 throw new MWException( 'Could not write SVG file!' );
 496+ wfRestoreWarnings();
489497 return false;
490498 }
 499+ wfRestoreWarnings();
491500 // Rasterize due to IE suckage
492501 $status = $svgHandler->rasterize( $svgPath, $filePath, 1000, 410 );
493502 if( $status !== true ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r56538merged r56536, r56537 error handling tweaksaaron16:37, 17 September 2009

Status & tagging log