r57699 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57698‎ | r57699 | r57700 >
Date:06:54, 14 October 2009
Author:tstarling
Status:deferred
Tags:
Comment:
Don't call User::getGroupPermissions() unless $wgImgAuthPublicTest==true. Efficiency measure suggested by ans-fox.
Modified paths:
  • /trunk/phase3/img_auth.php (modified) (history)

Diff [purge]

Index: trunk/phase3/img_auth.php
@@ -30,11 +30,12 @@
3131 wfProfileIn( 'img_auth.php' );
3232 require_once( dirname( __FILE__ ) . '/includes/StreamFile.php' );
3333
34 -$perms = User::getGroupPermissions( array( '*' ) );
35 -
3634 // See if this is a public Wiki (no protections)
37 -if ( $wgImgAuthPublicTest && in_array( 'read', $perms, true ) )
 35+if ( $wgImgAuthPublicTest
 36+ && in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) )
 37+{
3838 wfForbidden('img-auth-accessdenied','img-auth-public');
 39+}
3940
4041 // Extract path and image information
4142 if( !isset( $_SERVER['PATH_INFO'] ) )

Status & tagging log