From: Tim Starling Date: Wed, 14 Oct 2009 06:54:21 +0000 (+0000) Subject: Don't call User::getGroupPermissions() unless $wgImgAuthPublicTest==true. Efficiency... X-Git-Tag: 1.31.0-rc.0~39291 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=83793144b4450edd399a5430bf2e9e7ab29f1973;p=lhc%2Fweb%2Fwiklou.git Don't call User::getGroupPermissions() unless $wgImgAuthPublicTest==true. Efficiency measure suggested by ans-fox. --- 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'] ) )