X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=blobdiff_plain;f=profileinfo.php;h=d000972051e5dc50a8136f8c98a9e0774e10e188;hb=f5a31f5be0c23bb14a754032803aa226ce761411;hp=ca8c1bbbfa51da722eb5559561f0a7e72ec87b99;hpb=220bda9175a18458449e9d754fb48830c1f76f25;p=lhc%2Fweb%2Fwiklou.git diff --git a/profileinfo.php b/profileinfo.php index ca8c1bbbfa..d000972051 100644 --- a/profileinfo.php +++ b/profileinfo.php @@ -1,6 +1,17 @@ tableExists( 'profiling' ) ) { echo '

No profiling table exists, so we can\'t show you anything.

' . '

If you want to log profiling data, enable $wgProfiler[\'output\'] = \'db\'' - . ' in your StartProfiler.php and run maintenance/update.php to' + . ' in LocalSettings.php and run maintenance/update.php to' . ' create the profiling table.' . ''; exit( 1 ); @@ -284,31 +293,33 @@ class profile_point { public function fmttime() { return sprintf( '%5.02f', $this->time ); } -}; +} function compare_point( profile_point $a, profile_point $b ) { // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix global $sort; switch ( $sort ) { + // Sorted ascending: case 'name': return strcmp( $a->name(), $b->name() ); + // Sorted descending: case 'time': - return $a->time() > $b->time() ? -1 : 1; + return $b->time() <=> $a->time(); case 'memory': - return $a->memory() > $b->memory() ? -1 : 1; + return $b->memory() <=> $a->memory(); case 'count': - return $a->count() > $b->count() ? -1 : 1; + return $b->count() <=> $a->count(); case 'time_per_call': - return $a->timePerCall() > $b->timePerCall() ? -1 : 1; + return $b->timePerCall() <=> $a->timePerCall(); case 'memory_per_call': - return $a->memoryPerCall() > $b->memoryPerCall() ? -1 : 1; + return $b->memoryPerCall() <=> $a->memoryPerCall(); case 'calls_per_req': - return $a->callsPerRequest() > $b->callsPerRequest() ? -1 : 1; + return $b->callsPerRequest() <=> $a->callsPerRequest(); case 'time_per_req': - return $a->timePerRequest() > $b->timePerRequest() ? -1 : 1; + return $b->timePerRequest() <=> $a->timePerRequest(); case 'memory_per_req': - return $a->memoryPerRequest() > $b->memoryPerRequest() ? -1 : 1; + return $b->memoryPerRequest() <=> $a->memoryPerRequest(); } } @@ -327,11 +338,7 @@ $res = $dbr->select( [ 'ORDER BY' => 'pf_name ASC' ] ); -if ( isset( $_REQUEST['filter'] ) ) { - $filter = $_REQUEST['filter']; -} else { - $filter = ''; -} +$filter = $_REQUEST['filter'] ?? ''; ?>

@@ -394,8 +401,8 @@ if ( isset( $_REQUEST['filter'] ) ) { return htmlspecialchars( '?' . wfArrayToCgi( [ - 'filter' => $_filter ? $_filter : $filter, - 'sort' => $_sort ? $_sort : $sort, + 'filter' => $_filter ?: $filter, + 'sort' => $_sort ?: $sort, 'expand' => implode( ',', array_keys( $_expand ) ) ] ) );