GitInfo: Don't try shelling out if it's disabled
[lhc/web/wiklou.git] / includes / auth / AuthManager.php
index 9ed6d13..3260ce4 100644 (file)
@@ -240,7 +240,7 @@ class AuthManager implements LoggerAwareInterface {
                global $wgAuth;
 
                if ( $wgAuth && !$wgAuth instanceof AuthManagerAuthPlugin ) {
-                       return call_user_func_array( [ $wgAuth, $method ], $params );
+                       return $wgAuth->$method( ...$params );
                } else {
                        return $return;
                }
@@ -771,7 +771,12 @@ class AuthManager implements LoggerAwareInterface {
                        $status = self::SEC_FAIL;
                }
 
-               $this->logger->info( __METHOD__ . ": $operation is $status" );
+               $this->logger->info( __METHOD__ . ": $operation is $status for '{user}'",
+                       [
+                               'user' => $session->getUser()->getName(),
+                               'clientip' => $this->getRequest()->getIP(),
+                       ]
+               );
 
                return $status;
        }
@@ -985,7 +990,7 @@ class AuthManager implements LoggerAwareInterface {
                if ( $permErrors ) {
                        $status = Status::newGood();
                        foreach ( $permErrors as $args ) {
-                               call_user_func_array( [ $status, 'fatal' ], $args );
+                               $status->fatal( ...$args );
                        }
                        return $status;
                }
@@ -1675,7 +1680,7 @@ class AuthManager implements LoggerAwareInterface {
                }
 
                // Checks passed, create the user...
-               $from = isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : 'CLI';
+               $from = $_SERVER['REQUEST_URI'] ?? 'CLI';
                $this->logger->info( __METHOD__ . ': creating new user ({username}) - from: {from}', [
                        'username' => $username,
                        'from' => $from,
@@ -2286,9 +2291,10 @@ class AuthManager implements LoggerAwareInterface {
                        $spec = [ 'sort2' => $i++ ] + $spec + [ 'sort' => 0 ];
                }
                unset( $spec );
+               // Sort according to the 'sort' field, and if they are equal, according to 'sort2'
                usort( $specs, function ( $a, $b ) {
-                       return ( (int)$a['sort'] ) - ( (int)$b['sort'] )
-                               ?: $a['sort2'] - $b['sort2'];
+                       return $a['sort'] <=> $b['sort']
+                               ?: $a['sort2'] <=> $b['sort2'];
                } );
 
                $ret = [];
@@ -2426,7 +2432,7 @@ class AuthManager implements LoggerAwareInterface {
                        $providers += $this->getSecondaryAuthenticationProviders();
                }
                foreach ( $providers as $provider ) {
-                       call_user_func_array( [ $provider, $method ], $args );
+                       $provider->$method( ...$args );
                }
        }