From 83793144b4450edd399a5430bf2e9e7ab29f1973 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Wed, 14 Oct 2009 06:54:21 +0000 Subject: [PATCH] Don't call User::getGroupPermissions() unless $wgImgAuthPublicTest==true. Efficiency measure suggested by ans-fox. --- img_auth.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/img_auth.php b/img_auth.php index 8246d7e6ee..bc4464d4cc 100644 --- a/img_auth.php +++ b/img_auth.php @@ -30,11 +30,12 @@ require_once( dirname( __FILE__ ) . '/includes/WebStart.php' ); wfProfileIn( 'img_auth.php' ); require_once( dirname( __FILE__ ) . '/includes/StreamFile.php' ); -$perms = User::getGroupPermissions( array( '*' ) ); - // See if this is a public Wiki (no protections) -if ( $wgImgAuthPublicTest && in_array( 'read', $perms, true ) ) +if ( $wgImgAuthPublicTest + && in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) ) +{ wfForbidden('img-auth-accessdenied','img-auth-public'); +} // Extract path and image information if( !isset( $_SERVER['PATH_INFO'] ) ) -- 2.20.1