MediaWiki  1.23.2
ProfilerSimpleText.php
Go to the documentation of this file.
1 <?php
35  public $visible = false; /* Show as <PRE> or <!-- ? */
36  static private $out;
37 
38  public function __construct( $profileConfig ) {
39  if ( isset( $profileConfig['visible'] ) && $profileConfig['visible'] ) {
40  $this->visible = true;
41  }
42  parent::__construct( $profileConfig );
43  }
44 
45  public function logData() {
46  if ( $this->mTemplated ) {
47  $this->close();
48  $totalReal = isset( $this->mCollated['-total'] )
49  ? $this->mCollated['-total']['real']
50  : 0; // profiling mismatch error?
51  uasort( $this->mCollated, array( 'self', 'sort' ) );
52  array_walk( $this->mCollated, array( 'self', 'format' ), $totalReal );
53  if ( PHP_SAPI === 'cli' ) {
54  print "<!--\n" . self::$out . "\n-->\n";
55  } elseif ( $this->getContentType() === 'text/html' ) {
56  if ( $this->visible ) {
57  print '<pre>' . self::$out . '</pre>';
58  } else {
59  print "<!--\n" . self::$out . "\n-->\n";
60  }
61  } elseif ( $this->getContentType() === 'text/javascript' ) {
62  print "\n/*\n" . self::$out . "*/\n";
63  } elseif ( $this->getContentType() === 'text/css' ) {
64  print "\n/*\n" . self::$out . "*/\n";
65  }
66  }
67  }
68 
69  static function sort( $a, $b ) {
70  return $a['real'] < $b['real']; /* sort descending by time elapsed */
71  }
72 
73  static function format( $item, $key, $totalReal ) {
74  $perc = $totalReal ? $item['real'] / $totalReal * 100 : 0;
75  self::$out .= sprintf( "%6.2f%% %3.6f %6d - %s\n",
76  $perc, $item['real'], $item['count'], $key );
77  }
78 }
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
ProfilerSimpleText\$visible
$visible
Definition: ProfilerSimpleText.php:35
Profiler\getContentType
getContentType()
Get the content type sent out to the client.
Definition: Profiler.php:775
ProfilerSimpleText\format
static format( $item, $key, $totalReal)
Definition: ProfilerSimpleText.php:73
ProfilerSimpleText\sort
static sort( $a, $b)
Definition: ProfilerSimpleText.php:69
ProfilerSimpleText
The least sophisticated profiler output class possible, view your source! :)
Definition: ProfilerSimpleText.php:34
$out
$out
Definition: UtfNormalGenerate.php:167
Profiler\close
close()
Close opened profiling sections.
Definition: Profiler.php:253
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
ProfilerSimpleText\$out
static $out
Definition: ProfilerSimpleText.php:36
ProfilerSimpleText\logData
logData()
Log the whole profiling data into the database.
Definition: ProfilerSimpleText.php:45
ProfilerSimpleText\__construct
__construct( $profileConfig)
Definition: ProfilerSimpleText.php:38
ProfilerSimple
Simple profiler base class.
Definition: ProfilerSimple.php:29