Index: trunk/phase3/maintenance/language/messageTypes.inc |
— | — | @@ -311,6 +311,7 @@ |
312 | 312 | 'seconds-abbrev', |
313 | 313 | 'minutes-abbrev', |
314 | 314 | 'hours-abbrev', |
| 315 | + 'days-abbrev', |
315 | 316 | 'filerevert-backlink', |
316 | 317 | 'filedelete-backlink', |
317 | 318 | 'delete-backlink', |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -3658,6 +3658,7 @@ |
3659 | 3659 | 'seconds-abbrev' => 's', # only translate this message to other languages if you have to change it |
3660 | 3660 | 'minutes-abbrev' => 'm', # only translate this message to other languages if you have to change it |
3661 | 3661 | 'hours-abbrev' => 'h', # only translate this message to other languages if you have to change it |
| 3662 | +'days-abbrev' => 'd', # only translate this message to other languages if you have to change it |
3662 | 3663 | |
3663 | 3664 | # Bad image list |
3664 | 3665 | 'bad_image_list' => 'The format is as follows: |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -3410,14 +3410,19 @@ |
3411 | 3411 | |
3412 | 3412 | /** |
3413 | 3413 | * @todo Document |
3414 | | - * @param $seconds String |
| 3414 | + * @param $seconds int|float |
| 3415 | + * @param $format String Optional, one of ("avoidseconds","avoidseconds"): |
| 3416 | + * If "avoidminutes" don't mention minutes if $seconds >= 1 hour |
| 3417 | + * If "avoidseconds" don't mention seconds/minutes if $seconds > 2 days |
3415 | 3418 | * @return string |
3416 | 3419 | */ |
3417 | | - function formatTimePeriod( $seconds ) { |
| 3420 | + function formatTimePeriod( $seconds, $format = false ) { |
3418 | 3421 | if ( round( $seconds * 10 ) < 100 ) { |
3419 | | - return $this->formatNum( sprintf( "%.1f", round( $seconds * 10 ) / 10 ) ) . $this->getMessageFromDB( 'seconds-abbrev' ); |
| 3422 | + return $this->formatNum( sprintf( "%.1f", round( $seconds * 10 ) / 10 ) ) . |
| 3423 | + $this->getMessageFromDB( 'seconds-abbrev' ); |
3420 | 3424 | } elseif ( round( $seconds ) < 60 ) { |
3421 | | - return $this->formatNum( round( $seconds ) ) . $this->getMessageFromDB( 'seconds-abbrev' ); |
| 3425 | + return $this->formatNum( round( $seconds ) ) . |
| 3426 | + $this->getMessageFromDB( 'seconds-abbrev' ); |
3422 | 3427 | } elseif ( round( $seconds ) < 3600 ) { |
3423 | 3428 | $minutes = floor( $seconds / 60 ); |
3424 | 3429 | $secondsPart = round( fmod( $seconds, 60 ) ); |
— | — | @@ -3425,23 +3430,31 @@ |
3426 | 3431 | $secondsPart = 0; |
3427 | 3432 | $minutes++; |
3428 | 3433 | } |
3429 | | - return $this->formatNum( $minutes ) . $this->getMessageFromDB( 'minutes-abbrev' ) . ' ' . |
| 3434 | + return $this->formatNum( $minutes ) . $this->getMessageFromDB( 'minutes-abbrev' ) . |
| 3435 | + ' ' . |
3430 | 3436 | $this->formatNum( $secondsPart ) . $this->getMessageFromDB( 'seconds-abbrev' ); |
3431 | | - } else { |
| 3437 | + } elseif ( round( $seconds ) <= 2*86400 ) { |
3432 | 3438 | $hours = floor( $seconds / 3600 ); |
3433 | 3439 | $minutes = floor( ( $seconds - $hours * 3600 ) / 60 ); |
3434 | | - $secondsPart = round( $seconds - $hours * 3600 - $minutes * 60 ); |
3435 | | - if ( $secondsPart == 60 ) { |
3436 | | - $secondsPart = 0; |
3437 | | - $minutes++; |
| 3440 | + $secondsPart = floor( $seconds - $hours * 3600 - $minutes * 60 ); |
| 3441 | + $s = $this->formatNum( $hours ) . $this->getMessageFromDB( 'hours-abbrev' ) . |
| 3442 | + ' ' . |
| 3443 | + $this->formatNum( $minutes ) . $this->getMessageFromDB( 'minutes-abbrev' ); |
| 3444 | + if ( $format !== 'avoidseconds' ) { |
| 3445 | + $s .= ' ' . $this->formatNum( $secondsPart ) . |
| 3446 | + $this->getMessageFromDB( 'seconds-abbrev' ); |
3438 | 3447 | } |
3439 | | - if ( $minutes == 60 ) { |
3440 | | - $minutes = 0; |
3441 | | - $hours++; |
| 3448 | + return $s; |
| 3449 | + } else { |
| 3450 | + $days = floor( $seconds / 86400 ); |
| 3451 | + $s = $this->formatNum( $days ) . $this->getMessageFromDB( 'days-abbrev' ) . ' '; |
| 3452 | + if ( $format === 'avoidminutes' ) { |
| 3453 | + $hours = floor( ( $seconds - $days * 86400 ) / 3600 ); |
| 3454 | + $s .= $this->formatNum( $hours ) . $this->getMessageFromDB( 'hours-abbrev' ); |
| 3455 | + } else { |
| 3456 | + $s .= $this->formatTimePeriod( $seconds - $days * 86400, $format ); |
3442 | 3457 | } |
3443 | | - return $this->formatNum( $hours ) . $this->getMessageFromDB( 'hours-abbrev' ) . ' ' . |
3444 | | - $this->formatNum( $minutes ) . $this->getMessageFromDB( 'minutes-abbrev' ) . ' ' . |
3445 | | - $this->formatNum( $secondsPart ) . $this->getMessageFromDB( 'seconds-abbrev' ); |
| 3458 | + return $s; |
3446 | 3459 | } |
3447 | 3460 | } |
3448 | 3461 | |
Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevsStats.php |
— | — | @@ -97,13 +97,13 @@ |
98 | 98 | |
99 | 99 | $dataSet = array(); |
100 | 100 | $dataSet[] = array( |
101 | | - 'frs_stat_key' => 'reviewLag-sampleStartTimestamp', |
102 | | - 'frs_stat_val' => $reviewData['sampleStartTS'], // unix |
103 | | - 'frs_timestamp' => $encDataTimestamp ); |
| 101 | + 'frs_stat_key' => 'reviewLag-sampleStartTimestamp', |
| 102 | + 'frs_stat_val' => $reviewData['sampleStartTS'], // unix |
| 103 | + 'frs_timestamp' => $encDataTimestamp ); |
104 | 104 | $dataSet[] = array( |
105 | | - 'frs_stat_key' => 'reviewLag-sampleEndTimestamp', |
106 | | - 'frs_stat_val' => $reviewData['sampleEndTS'], // unix |
107 | | - 'frs_timestamp' => $encDataTimestamp ); |
| 105 | + 'frs_stat_key' => 'reviewLag-sampleEndTimestamp', |
| 106 | + 'frs_stat_val' => $reviewData['sampleEndTS'], // unix |
| 107 | + 'frs_timestamp' => $encDataTimestamp ); |
108 | 108 | // All-namespace percentiles... |
109 | 109 | foreach( $rPerTable as $percentile => $seconds ) { |
110 | 110 | $dataSet[] = array( |
Index: trunk/extensions/FlaggedRevs/presentation/specialpages/reports/ValidationStatistics_body.php |
— | — | @@ -32,11 +32,12 @@ |
33 | 33 | } |
34 | 34 | |
35 | 35 | # Is there a review time table available? |
36 | | - if ( is_array( $pData ) && count( $pData ) ) { |
| 36 | + if ( count( $pData ) ) { |
37 | 37 | $headerRows = $dataRows = ''; |
38 | 38 | foreach ( $pData as $percentile => $perValue ) { |
39 | 39 | $headerRows .= "<th>P<sub>" . intval( $percentile ) . "</sub></th>"; |
40 | | - $dataRows .= '<td>' . $wgLang->formatTimePeriod( $perValue ) . '</td>'; |
| 40 | + $dataRows .= '<td>' . |
| 41 | + $wgLang->formatTimePeriod( $perValue, 'avoidminutes' ) . '</td>'; |
41 | 42 | } |
42 | 43 | $css = 'wikitable flaggedrevs_stats_table'; |
43 | 44 | $reviewChart = "<table class='$css' style='white-space: nowrap;'>\n"; |
— | — | @@ -50,18 +51,19 @@ |
51 | 52 | if ( $timestamp != '-' ) { |
52 | 53 | # Show "last updated"... |
53 | 54 | $wgOut->addWikiMsg( 'validationstatistics-lastupdate', |
54 | | - $wgLang->date( $timestamp, true ), |
55 | | - $wgLang->time( $timestamp, true ) |
| 55 | + $wgLang->date( $timestamp, true ), |
| 56 | + $wgLang->time( $timestamp, true ) |
56 | 57 | ); |
57 | 58 | } |
58 | 59 | $wgOut->addHtml( '<hr/>' ); |
59 | 60 | # Show pending time stats... |
60 | | - $wgOut->addWikiMsg( 'validationstatistics-pndtime', $wgLang->formatTimePeriod( $pt ) ); |
| 61 | + $wgOut->addWikiMsg( 'validationstatistics-pndtime', |
| 62 | + $wgLang->formatTimePeriod( $pt, 'avoidminutes' ) ); |
61 | 63 | # Show review time stats... |
62 | 64 | if ( !FlaggedRevs::useOnlyIfProtected() ) { |
63 | 65 | $wgOut->addWikiMsg( 'validationstatistics-revtime', |
64 | | - $wgLang->formatTimePeriod( $mt ), |
65 | | - $wgLang->formatTimePeriod( $mdt ), |
| 66 | + $wgLang->formatTimePeriod( $mt, 'avoidminutes' ), |
| 67 | + $wgLang->formatTimePeriod( $mdt, 'avoidminutes' ), |
66 | 68 | $reviewChart |
67 | 69 | ); |
68 | 70 | } |