Hoo man has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/73520


Change subject: Don't cache in User::isEveryoneAllowed in unit tests
......................................................................

Don't cache in User::isEveryoneAllowed in unit tests

Extension unit tests depend on being able change these
mid-request (that would never happen in normal usage).

Change-Id: Ic32da022cf774341631686e6345969acc1aa5055
---
M includes/User.php
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/20/73520/1

diff --git a/includes/User.php b/includes/User.php
index fa489b3..685bce7 100644
--- a/includes/User.php
+++ b/includes/User.php
@@ -4000,7 +4000,9 @@
                global $wgGroupPermissions, $wgRevokePermissions;
                static $cache = array();
 
-               if ( isset( $cache[$right] ) ) {
+               // Use the cached results, except in unit tests which rely on
+               // being able change the permission mid-request
+               if ( isset( $cache[$right] ) && !defined( 'MW_PHPUNIT_TEST' ) ) 
{
                        return $cache[$right];
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/73520
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic32da022cf774341631686e6345969acc1aa5055
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to