r45977 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45976‎ | r45977 | r45978 >
Date:21:02, 21 January 2009
Author:aaron
Status:ok
Tags:
Comment:
Division by zero notice fixes
Modified paths:
  • /trunk/extensions/FlaggedRevs/specialpages/RatingHistory_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/specialpages/RatingHistory_body.php
@@ -262,6 +262,7 @@
263263 $totalVal = $totalCount = $n = 0;
264264 // Define the data using the DB rows
265265 list($res,$u,$maxC,$days) = $this->doQuery( $tag );
 266+ if( !$maxC ) return false;
266267 // Label spacing
267268 $int = intval( ceil($days/10) ); // 10 labels at most
268269 while( $row = $res->fetchObject() ) {
@@ -362,6 +363,7 @@
363364 $totalVal = $totalCount = $sd = $pts = $n = 0;
364365 // Define the data using the DB rows
365366 list($res,$u,$maxC,$days) = $this->doQuery( $tag );
 367+ if( !$maxC ) return false;
366368 // Label spacing
367369 $int = intval( ceil($days/10) ); // 10 labels at most
368370 while( $row = $res->fetchObject() ) {
@@ -495,7 +497,8 @@
496498 }
497499 $upper = wfTimestamp( TS_UNIX, $upper );
498500 $days = intval( ($upper - $lower)/86400 );
499 - $ave = 1 + $total/$count; // Offset to [1,5]
 501+ if( $count )
 502+ $ave = 1 + $total/$count; // Offset to [1,5]
500503 $res->seek( 0 ); // reset query row
501504 }
502505 return array($res,$ave,$maxC,$days);

Status & tagging log