Revision: 45977
Author:   aaron
Date:     2009-01-21 21:02:46 +0000 (Wed, 21 Jan 2009)

Log Message:
-----------
Division by zero notice fixes

Modified Paths:
--------------
    trunk/extensions/FlaggedRevs/specialpages/RatingHistory_body.php

Modified: trunk/extensions/FlaggedRevs/specialpages/RatingHistory_body.php
===================================================================
--- trunk/extensions/FlaggedRevs/specialpages/RatingHistory_body.php    
2009-01-21 20:57:54 UTC (rev 45976)
+++ trunk/extensions/FlaggedRevs/specialpages/RatingHistory_body.php    
2009-01-21 21:02:46 UTC (rev 45977)
@@ -262,6 +262,7 @@
                $totalVal = $totalCount = $n = 0;
                // Define the data using the DB rows
                list($res,$u,$maxC,$days) = $this->doQuery( $tag );
+               if( !$maxC ) return false;
                // Label spacing
                $int = intval( ceil($days/10) ); // 10 labels at most
                while( $row = $res->fetchObject() ) {
@@ -362,6 +363,7 @@
                $totalVal = $totalCount = $sd = $pts = $n = 0;
                // Define the data using the DB rows
                list($res,$u,$maxC,$days) = $this->doQuery( $tag );
+               if( !$maxC ) return false;
                // Label spacing
                $int = intval( ceil($days/10) ); // 10 labels at most
                while( $row = $res->fetchObject() ) {
@@ -495,7 +497,8 @@
                        }
                        $upper = wfTimestamp( TS_UNIX, $upper );
                        $days = intval( ($upper - $lower)/86400 );
-                       $ave = 1 + $total/$count; // Offset to [1,5]
+                       if( $count )
+                               $ave = 1 + $total/$count; // Offset to [1,5]
                        $res->seek( 0 ); // reset query row
                }
                return array($res,$ave,$maxC,$days);



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to