* @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;
exit( 1 );
}
-$dbr = wfGetDB( DB_SLAVE );
+$dbr = wfGetDB( DB_REPLICA );
if ( !$dbr->tableExists( 'profiling' ) ) {
echo '<p>No <code>profiling</code> table exists, so we can\'t show you anything.</p>'
exit( 1 );
}
-$expand = array();
+$expand = [];
if ( isset( $_REQUEST['expand'] ) ) {
foreach ( explode( ',', $_REQUEST['expand'] ) as $f ) {
$expand[$f] = true;
$this->count = $count;
$this->time = $time;
$this->memory = $memory;
- $this->children = array();
+ $this->children = [];
}
public function add_child( $child ) {
if ( !$ex ) {
if ( count( $this->children ) ) {
- $url = getEscapedProfileUrl( false, false, $expand + array( $this->name() => true ) );
+ $url = getEscapedProfileUrl( false, false, $expand + [ $this->name() => true ] );
$extet = " <a id=\"{$anchor}\" href=\"{$url}#{$anchor}\">[+]</a>";
} 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 );
}
}
-$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' )
+ [ 'ORDER BY' => 'pf_name ASC' ]
);
if ( isset( $_REQUEST['filter'] ) ) {
return htmlspecialchars(
'?' .
- wfArrayToCgi( array(
+ wfArrayToCgi( [
'filter' => $_filter ? $_filter : $filter,
'sort' => $_sort ? $_sort : $sort,
'expand' => implode( ',', array_keys( $_expand ) )
- ) )
+ ] )
);
}
- $points = array();
- $queries = array();
+ $points = [];
+ $queries = [];
$sqltotal = 0.0;
$last = false;