r69227 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69226‎ | r69227 | r69228 >
Date:09:23, 10 July 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Fix yet more bugs when trying to display only hourly edits
Modified paths:
  • /trunk/extensions/Translate/SpecialTranslationStats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/SpecialTranslationStats.php
@@ -290,16 +290,12 @@
291291 if ( $opts['scale'] === 'hours' ) $increment = 3600;
292292
293293 $labels = $so->labels();
294 - if ( count($labels) ) {
295 - $keys = array_keys( $labels );
296 - $values = array_pad( array(), count( $labels ), 0 );
297 - $defaults = array_combine( $keys, $values );
298 - } else {
299 - $defaults = array( '0' => '0' );
300 - }
 294+ $keys = array_keys( $labels );
 295+ $values = array_pad( array(), count( $labels ), 0 );
 296+ $defaults = array_combine( $keys, $values );
301297
302298 $data = array();
303 - while ( $cutoff < $now ) {
 299+ while ( $cutoff <= $now+$increment ) {
304300 $date = $wgLang->sprintfDate( $dateFormat, wfTimestamp( TS_MW, $cutoff ) );
305301 $cutoff += $increment;
306302 $data[$date] = $defaults;
@@ -319,6 +315,11 @@
320316 }
321317 }
322318
 319+ // Don't display dummy label
 320+ if ( count( $labels ) === 1 && $labels[0] === 'all' ) {
 321+ $labels = array();
 322+ }
 323+
323324 return array( $labels, $data );
324325 }
325326
@@ -378,7 +379,6 @@
379380
380381 $plot->SetTransparentColor( 'white' );
381382 $plot->SetBackgroundColor( 'white' );
382 - // $plot->SetFileFormat('gif');
383383
384384 // Draw it
385385 $plot->DrawGraph();
@@ -489,7 +489,7 @@
490490 } elseif ( $group || $code ) {
491491 return "$group$code";
492492 } else {
493 - return "Test";
 493+ return 'all';
494494 }
495495 }
496496

Status & tagging log