r44968 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44967‎ | r44968 | r44969 >
Date:20:44, 23 December 2008
Author:aaron
Status:ok
Tags:
Comment:
Use file_put_contents()
Modified paths:
  • /trunk/extensions/FlaggedRevs/specialpages/RatingHistory_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/specialpages/RatingHistory_body.php
@@ -473,12 +473,12 @@
474474 $plot->generateSVG( "xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'" );
475475 // Write to file for cache
476476 $svgPath = $this->getFilePath( $tag, 'svg' );
477 - $fp = @fopen( $svgPath, 'w' );
478 - @fwrite( $fp, $plot->svg );
 477+ $svgHandler = new SvgHandler();
 478+ if( !@file_put_contents( $svgPath, $plot->svg ) ) {
 479+ return false;
 480+ }
479481 // Rasterize due to IE suckage
480 - $svgHandler = new SvgHandler();
481482 $status = $svgHandler->rasterize( $svgPath, $filePath, 1000, 410 );
482 - @fclose( $fp );
483483 if( $status !== true ) {
484484 return false;
485485 }

Status & tagging log