X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=profileinfo.php;h=8bd37dd4cb38259302cafd36dbeaf1113daa4677;hb=97c2b68a17a54a1cc0ed6d8e49e7d33e4543115c;hp=83ae1935df1719bb862b28a745f9239f45986f41;hpb=d84c3dde5af90c5c3497d18e427a5c2a38ac6ca8;p=lhc%2Fweb%2Fwiklou.git
diff --git a/profileinfo.php b/profileinfo.php
index 83ae1935df..8bd37dd4cb 100644
--- a/profileinfo.php
+++ b/profileinfo.php
@@ -168,9 +168,8 @@ if ( isset( $_REQUEST['expand'] ) ) {
}
}
-// @codingStandardsIgnoreStart
+// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
class profile_point {
- // @codingStandardsIgnoreEnd
public $name;
public $count;
@@ -222,7 +221,7 @@ class profile_point {
name() ) ) . $extet ?>
-
+
time() / self::$totaltime * 100 ); ?> |
memory() / self::$totalmemory * 100 ); ?> |
count(); ?> |
@@ -231,7 +230,7 @@ class profile_point {
memoryPerCall() / 1024 ), 2 ); ?> |
time() / self::$totalcount ), 2 ); ?> |
memory() / self::$totalcount / 1024 ), 2 ); ?> |
-
+
time / $this->count );
- // @codingStandardsIgnoreEnd
}
public function memoryPerCall() {
- // @codingStandardsIgnoreStart
+ // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
return @( $this->memory / $this->count );
- // @codingStandardsIgnoreEnd
}
public function callsPerRequest() {
- // @codingStandardsIgnoreStart
+ // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
return @( $this->count / self::$totalcount );
- // @codingStandardsIgnoreEnd
}
public function timePerRequest() {
- // @codingStandardsIgnoreStart
+ // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
return @( $this->time / self::$totalcount );
- // @codingStandardsIgnoreEnd
}
public function memoryPerRequest() {
- // @codingStandardsIgnoreStart
+ // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
return @( $this->memory / self::$totalcount );
- // @codingStandardsIgnoreEnd
}
public function fmttime() {
@@ -293,28 +287,30 @@ class profile_point {
};
function compare_point( profile_point $a, profile_point $b ) {
- // @codingStandardsIgnoreStart
+ // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
global $sort;
- // @codingStandardsIgnoreEnd
+
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();
}
}
@@ -390,9 +386,8 @@ if ( isset( $_REQUEST['filter'] ) ) {
profile_point::$totalmemory = 0.0;
function getEscapedProfileUrl( $_filter = false, $_sort = false, $_expand = false ) {
- // @codingStandardsIgnoreStart
+ // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
global $filter, $sort, $expand;
- // @codingStandardsIgnoreEnd
if ( $_expand === false ) {
$_expand = $expand;
@@ -401,8 +396,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 ) )
] )
);
@@ -441,9 +436,8 @@ if ( isset( $_REQUEST['filter'] ) ) {
}
$points[] = $s;
- // @codingStandardsIgnoreStart
+ // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
@usort( $points, 'compare_point' );
- // @codingStandardsIgnoreEnd
foreach ( $points as $point ) {
if ( strlen( $filter ) && !strstr( $point->name(), $filter ) ) {