Go to the documentation of this file.
41 define(
'MW_NO_SESSION', 1 );
43 ini_set(
'zlib.output_compression',
'off' );
45 require __DIR__ .
'/includes/WebStart.php';
47 header(
'Content-Type: text/html; charset=utf-8' );
53 <meta charset=
"UTF-8" />
66 font: 14px/1.6 sans-serif;
80 text-decoration: underline;
95 background-
color: transparent;
96 border-collapse: collapse;
110 border-top: 1px solid #ddd;
118 vertical-align: bottom;
121 .table thead:first-child tr:first-child th,
122 .table thead:first-child tr:first-child td {
126 .table tbody + tbody {
127 border-top: 2px solid #ddd;
131 .table-condensed td {
135 .table-striped tbody tr:nth-child(odd) td,
136 .table-striped tbody tr:nth-child(odd) th {
140 .table-hover tbody tr:hover td,
141 .table-hover tbody tr:hover th {
142 background-
color: #f5f5f5;
148 border-top: 1px solid #eee;
149 border-bottom: 1px solid #fff;
157 echo
'<p>Disabled</p>'
164 if ( !
$dbr->tableExists(
'profiling' ) ) {
165 echo
'<p>No <code>profiling</code> table exists, so we can\'t show you anything.</p>'
166 .
'<p>If you want to log profiling data, enable <code>$wgProfiler[\'output\'] = \'db\'</code>'
167 .
' in LocalSettings.php and run <code>maintenance/update.php</code> to'
168 .
' create the profiling table.'
174 if ( isset( $_REQUEST[
'expand'] ) ) {
175 foreach ( explode(
',', $_REQUEST[
'expand'] )
as $f ) {
195 $this->children = [];
199 $this->children[] = $child;
203 usort( $this->children,
'compare_point' );
207 $anchor = str_replace(
'"',
'', $this->
name() );
210 if (
count( $this->children ) ) {
212 $extet =
" <a id=\"{$anchor}\" href=\"{$url}#{$anchor}\">[+]</a>";
224 $extet =
" <a id=\"{$anchor}\" href=\"{$url}#{$anchor}\">[–]</a>";
229 <
div style=
"margin-left: <?php echo (int)$indent; ?>em;">
230 <?
php echo htmlspecialchars( str_replace(
',',
', ', $this->
name() ) ) . $extet ?>
234 <td
class=
"mw-profileinfo-timep"><?
php echo @
wfPercent( $this->
time() / self::$totaltime * 100 ); ?></td>
235 <td
class=
"mw-profileinfo-memoryp"><?
php echo @
wfPercent( $this->
memory() / self::$totalmemory * 100 ); ?></td>
236 <td
class=
"mw-profileinfo-count"><?
php echo $this->
count(); ?></td>
237 <td
class=
"mw-profileinfo-cpr"><?
php echo round( sprintf(
'%.2f', $this->
callsPerRequest() ), 2 ); ?></td>
238 <td
class=
"mw-profileinfo-tpc"><?
php echo round( sprintf(
'%.2f', $this->
timePerCall() ), 2 ); ?></td>
239 <td
class=
"mw-profileinfo-mpc"><?
php echo round( sprintf(
'%.2f', $this->
memoryPerCall() / 1024 ), 2 ); ?></td>
240 <td
class=
"mw-profileinfo-tpr"><?
php echo @round( sprintf(
'%.2f', $this->
time() / self::$totalcount ), 2 ); ?></td>
241 <td
class=
"mw-profileinfo-mpr"><?
php echo @round( sprintf(
'%.2f', $this->
memory() / self::$totalcount / 1024 ), 2 ); ?></td>
246 foreach ( $this->children
as $child ) {
247 $child->display(
$expand, $indent + 2 );
265 return $this->memory;
294 return sprintf(
'%5.02f', $this->
time );
305 return strcmp( $a->
name(), $b->
name() );
313 case 'time_per_call':
315 case 'memory_per_call':
317 case 'calls_per_req':
321 case 'memory_per_req':
326 $sorts = [
'time',
'memory',
'count',
'calls_per_req',
'name',
327 'time_per_call',
'memory_per_call',
'time_per_req',
'memory_per_req' ];
329 if ( isset( $_REQUEST[
'sort'] ) && in_array( $_REQUEST[
'sort'],
$sorts ) ) {
330 $sort = $_REQUEST[
'sort'];
338 [
'ORDER BY' =>
'pf_name ASC' ]
341 if ( isset( $_REQUEST[
'filter'] ) ) {
342 $filter = $_REQUEST[
'filter'];
350 <input
type=
"text" name=
"filter" value=
"<?php echo htmlspecialchars( $filter ); ?>">
351 <input
type=
"hidden" name=
"sort" value=
"<?php echo htmlspecialchars( $sort ); ?>">
353 echo htmlspecialchars( implode( ",
", array_keys( $expand ) ) );
359 <
table class=
"mw-profileinfo-table table table-striped table-hover">
363 echo getEscapedProfileUrl( false, 'name' );
366 echo getEscapedProfileUrl( false, 'time' );
367 ?>">Time (%)</
a></th>
369 echo getEscapedProfileUrl( false, 'memory' );
370 ?>">Memory (%)</
a></th>
372 echo getEscapedProfileUrl( false, 'count' );
375 echo getEscapedProfileUrl( false, 'calls_per_req' );
376 ?>">Calls/req</
a></th>
378 echo getEscapedProfileUrl( false, 'time_per_call' );
381 echo getEscapedProfileUrl( false, 'memory_per_call' );
384 echo getEscapedProfileUrl( false, 'time_per_req' );
387 echo getEscapedProfileUrl( false, 'memory_per_req' );
401 if ( $_expand ===
false ) {
405 return htmlspecialchars(
408 'filter' => $_filter ?: $filter,
409 'sort' => $_sort ?:
$sort,
410 'expand' => implode(
',', array_keys( $_expand ) )
421 $next =
new profile_point( $o->pf_name, $o->pf_count, $o->pf_time, $o->pf_memory );
422 if ( $next->name() ==
'-total' || $next->name() ==
'main()' ) {
427 if (
$last !==
false ) {
428 if ( preg_match(
'/^' . preg_quote(
$last->name(),
'/' ) .
'/', $next->name() ) ) {
429 $last->add_child( $next );
434 if ( preg_match(
'/^query: /', $next->name() ) || preg_match(
'/^query-m: /', $next->name() ) ) {
449 @usort(
$points,
'compare_point' );
452 if ( strlen( $filter ) && !strstr( $point->name(), $filter ) ) {
wfPercent( $nr, $acc=2, $round=true)
compare_point(profile_point $a, profile_point $b)
__construct( $name, $count, $time, $memory)
</source > ! result< div class="mw-highlight mw-content-ltr" dir="ltr">< pre >< span ></span >< span class="kd"> var</span >< span class="nx"> a</span >< span class="p"></span ></pre ></div > ! end ! test Multiline< source/> in lists !input *< source > a b</source > *foo< source > a b</source > ! html< ul >< li >< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul >< ul >< li > foo< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul > ! html tidy< ul >< li >< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul >< ul >< li > foo< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul > ! end ! test Custom attributes !input< source lang="javascript" id="foo" class="bar" dir="rtl" style="font-size: larger;"> var a
if( $inline) $status value
if(! $wgEnableProfileInfo) $dbr
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of data
MediaWiki has optional support for a high distributed memory object caching system For general information on but for a larger site with heavy like it should help lighten the load on the database servers by caching data and objects in memory
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
< td class="mw-profileinfo-timep"></tr > if( $ex) name()
</source > ! result< p > Text< code class="mw-highlight" dir="ltr">< span class="kd"> var</span >< span class="nx"> a</span >< span class="p"></span ></code ></p > ! end ! test Enclose none(inline code) !!input Text< source lang
and how to run hooks for an and one after Each event has a name
if(! $dbr->tableExists( 'profiling')) $expand
$wgEnableProfileInfo
Allow the profileinfo.php entrypoint to be used.
display( $expand, $indent=0.0)
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global then executing the whole list after the page is displayed We don t do anything smart like collating updates to the same table or such because the list is almost always going to have just one item on if so it s not worth the trouble Since there is a job queue in the jobs table
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
getEscapedProfileUrl( $_filter=false, $_sort=false, $_expand=false)
null means default in associative array form
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of or an object and a method hook function The function part of a third party developers and administrators to define code that will be run at certain points in the mainline code
if(isset( $_REQUEST['sort']) &&in_array( $_REQUEST['sort'], $sorts)) $res
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
in the sidebar</td >< td > font color
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
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....