X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=profileinfo.php;h=466f26aaec37202905481c630bd7fe117103e0c1;hb=a7b9cc4946a2f7fb081f64d9230bf944736a185b;hp=f172cfb6f20918117ca4235033b43ecdd1f951d4;hpb=8ad81cbb7538d837c0e2b5ce337b71f2d07f02a8;p=lhc%2Fweb%2Fwiklou.git diff --git a/profileinfo.php b/profileinfo.php index f172cfb6f2..466f26aaec 100644 --- a/profileinfo.php +++ b/profileinfo.php @@ -25,6 +25,11 @@ * @file */ +// This endpoint is supposed to be independent of request cookies and other +// details of the session. Log warnings for violations of the no-session +// constraint. +define( 'MW_NO_SESSION', 'warn' ); + ini_set( 'zlib.output_compression', 'off' ); $wgEnableProfileInfo = false; @@ -156,7 +161,7 @@ if ( !$dbr->tableExists( 'profiling' ) ) { exit( 1 ); } -$expand = array(); +$expand = []; if ( isset( $_REQUEST['expand'] ) ) { foreach ( explode( ',', $_REQUEST['expand'] ) as $f ) { $expand[$f] = true; @@ -179,7 +184,7 @@ class profile_point { $this->count = $count; $this->time = $time; $this->memory = $memory; - $this->children = array(); + $this->children = []; } public function add_child( $child ) { @@ -195,16 +200,16 @@ class profile_point { if ( !$ex ) { if ( count( $this->children ) ) { - $url = getEscapedProfileUrl( false, false, $expand + array( $this->name() => true ) ); + $url = getEscapedProfileUrl( false, false, $expand + [ $this->name() => true ] ); $extet = " [+]"; } else { $extet = ''; } } else { - $e = array(); + $e = []; foreach ( $expand as $name => $ep ) { if ( $name != $this->name() ) { - $e += array( $name => $ep ); + $e += [ $name => $ep ]; } } $url = getEscapedProfileUrl( false, false, $e ); @@ -313,14 +318,20 @@ function compare_point( profile_point $a, profile_point $b ) { } } -$sorts = array( 'time', 'memory', 'count', 'calls_per_req', 'name', - 'time_per_call', 'memory_per_call', 'time_per_req', 'memory_per_req' ); +$sorts = [ 'time', 'memory', 'count', 'calls_per_req', 'name', + 'time_per_call', 'memory_per_call', 'time_per_req', 'memory_per_req' ]; $sort = 'time'; if ( isset( $_REQUEST['sort'] ) && in_array( $_REQUEST['sort'], $sorts ) ) { $sort = $_REQUEST['sort']; } -$res = $dbr->select( 'profiling', '*', array(), 'profileinfo.php', array( 'ORDER BY' => 'pf_name ASC' ) ); +$res = $dbr->select( + 'profiling', + '*', + [], + 'profileinfo.php', + [ 'ORDER BY' => 'pf_name ASC' ] +); if ( isset( $_REQUEST['filter'] ) ) { $filter = $_REQUEST['filter']; @@ -333,7 +344,9 @@ if ( isset( $_REQUEST['filter'] ) ) {
- "> + ">
@@ -341,15 +354,33 @@ if ( isset( $_REQUEST['filter'] ) ) {Name | -Time (%) | -Memory (%) | -Count | -Calls/req | -ms/call | -kb/call | -ms/req | -kb/req | +Name | +Time (%) | +Memory (%) | +Count | +Calls/req | +ms/call | +kb/call | +ms/req | +kb/req |
---|