Avoid division by zero
authorTim Starling <tstarling@users.mediawiki.org>
Sat, 3 Jan 2009 00:19:33 +0000 (00:19 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sat, 3 Jan 2009 00:19:33 +0000 (00:19 +0000)
maintenance/storage/orphanStats.php

index 77bf465..afea815 100644 (file)
@@ -36,9 +36,11 @@ class OrphanStats {
                }
                unset( $res );
 
-               echo "Number of orphans: $num\n" .
-                       "Average size: " . round( $totalSize / $num, 0 ) . " bytes\n" .
+               echo "Number of orphans: $num\n";
+               if ( $num > 0 ) {
+                       echo "Average size: " . round( $totalSize / $num, 0 ) . " bytes\n" .
                        "Max size: $maxSize\n" . 
                        "Number of unique texts: " . count( $hashes ) . "\n";
+               }
        }
 }