MediaWiki  1.23.14
StatOutputs.php
Go to the documentation of this file.
1 <?php
27 class StatsOutput {
28  function formatPercent( $subset, $total, $revert = false, $accuracy = 2 ) {
30  $return = sprintf( '%.' . $accuracy . 'f%%', 100 * $subset / $total );
32  return $return;
33  }
34 
35  # Override the following methods
36  function heading() {
37  }
38 
39  function footer() {
40  }
41 
42  function blockstart() {
43  }
44 
45  function blockend() {
46  }
47 
48  function element( $in, $heading = false ) {
49  }
50 }
51 
54  function heading() {
55  global $wgDummyLanguageCodes;
57  echo "'''Statistics are based on:''' <code>" . $version . "</code>\n\n";
58  echo "'''Note:''' These statistics can be generated by running " .
59  "<code>php maintenance/language/transstat.php</code>.\n\n";
60  echo "For additional information on specific languages (the message names, the actual " .
61  "problems, etc.), run <code>php maintenance/language/checkLanguage.php --lang=foo</code>.\n\n";
62  echo 'English (en) is excluded because it is the default localization';
63  if ( is_array( $wgDummyLanguageCodes ) ) {
64  $dummyCodes = array();
65  foreach ( $wgDummyLanguageCodes as $dummyCode => $correctCode ) {
66  $dummyCodes[] = Language::fetchLanguageName( $dummyCode ) . ' (' . $dummyCode . ')';
67  }
68  echo ', as well as the following languages that are not intended for ' .
69  'system message translations, usually because they redirect to other ' .
70  'language codes: ' . implode( ', ', $dummyCodes );
71  }
72  echo ".\n\n"; # dot to end sentence
73  echo '{| class="sortable wikitable" border="2" style="background-color: #F9F9F9; ' .
74  'border: 1px #AAAAAA solid; border-collapse: collapse; clear:both; width:100%;"' . "\n";
75  }
76 
77  function footer() {
78  echo "|}\n";
79  }
80 
81  function blockstart() {
82  echo "|-\n";
83  }
84 
85  function blockend() {
86  echo '';
87  }
88 
89  function element( $in, $heading = false ) {
90  echo ( $heading ? '!' : '|' ) . "$in\n";
91  }
92 
93  function formatPercent( $subset, $total, $revert = false, $accuracy = 2 ) {
95  $v = round( 255 * $subset / $total );
97 
98  if ( $revert ) {
99  # Weigh reverse with factor 20 so coloring takes effect more quickly as
100  # this option is used solely for reporting 'bad' percentages.
101  $v = $v * 20;
102  if ( $v > 255 ) {
103  $v = 255;
104  }
105  $v = 255 - $v;
106  }
107  if ( $v < 128 ) {
108  # Red to Yellow
109  $red = 'FF';
110  $green = sprintf( '%02X', 2 * $v );
111  } else {
112  # Yellow to Green
113  $red = sprintf( '%02X', 2 * ( 255 - $v ) );
114  $green = 'FF';
115  }
116  $blue = '00';
117  $color = $red . $green . $blue;
118 
119  $percent = parent::formatPercent( $subset, $total, $revert, $accuracy );
120 
121  return 'style="background-color:#' . $color . ';"|' . $percent;
122  }
123 }
124 
127  function element( $in, $heading = false ) {
128  echo $in . "\t";
129  }
130 
131  function blockend() {
132  echo "\n";
133  }
134 }
135 
138  function element( $in, $heading = false ) {
139  echo $in . ";";
140  }
141 
142  function blockend() {
143  echo "\n";
144  }
145 }
CsvStatsOutput
csv output.
Definition: StatOutputs.php:137
$revert
this hook is for auditing only etc create2 Corresponds to logging log_action database field and which is displayed in the UI & $revert
Definition: hooks.txt:1644
StatsOutput\blockstart
blockstart()
Definition: StatOutputs.php:42
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
WikiStatsOutput\blockend
blockend()
Definition: StatOutputs.php:85
WikiStatsOutput\footer
footer()
Definition: StatOutputs.php:77
wfSuppressWarnings
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
Definition: GlobalFunctions.php:2434
TextStatsOutput\blockend
blockend()
Definition: StatOutputs.php:131
StatsOutput\footer
footer()
Definition: StatOutputs.php:39
$in
$in
Definition: Utf8Test.php:42
StatsOutput\blockend
blockend()
Definition: StatOutputs.php:45
TextStatsOutput
Output text.
Definition: StatOutputs.php:126
$total
$total
Definition: Utf8Test.php:92
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2464
StatsOutput\formatPercent
formatPercent( $subset, $total, $revert=false, $accuracy=2)
Definition: StatOutputs.php:28
StatsOutput
A general output object.
Definition: StatOutputs.php:27
CsvStatsOutput\blockend
blockend()
Definition: StatOutputs.php:142
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
StatsOutput\element
element( $in, $heading=false)
Definition: StatOutputs.php:48
TextStatsOutput\element
element( $in, $heading=false)
Definition: StatOutputs.php:127
$version
$version
Definition: parserTests.php:86
WikiStatsOutput\element
element( $in, $heading=false)
Definition: StatOutputs.php:89
Language\fetchLanguageName
static fetchLanguageName( $code, $inLanguage=null, $include='all')
Definition: Language.php:941
WikiStatsOutput\blockstart
blockstart()
Definition: StatOutputs.php:81
WikiStatsOutput\formatPercent
formatPercent( $subset, $total, $revert=false, $accuracy=2)
Definition: StatOutputs.php:93
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
WikiStatsOutput\heading
heading()
Definition: StatOutputs.php:54
CsvStatsOutput\element
element( $in, $heading=false)
Definition: StatOutputs.php:138
WikiStatsOutput
Outputs WikiText.
Definition: StatOutputs.php:53
StatsOutput\heading
heading()
Definition: StatOutputs.php:36
SpecialVersion\getVersion
static getVersion( $flags='')
Return a string of the MediaWiki version with SVN revision if available.
Definition: SpecialVersion.php:246