Index: trunk/phase3/includes/User.php |
— | — | @@ -1138,13 +1138,14 @@ |
1139 | 1139 | $keys = array(); |
1140 | 1140 | $id = $this->getId(); |
1141 | 1141 | $ip = wfGetIP(); |
| 1142 | + $userLimit = false; |
1142 | 1143 | |
1143 | 1144 | if( isset( $limits['anon'] ) && $id == 0 ) { |
1144 | 1145 | $keys[wfMemcKey( 'limiter', $action, 'anon' )] = $limits['anon']; |
1145 | 1146 | } |
1146 | 1147 | |
1147 | 1148 | if( isset( $limits['user'] ) && $id != 0 ) { |
1148 | | - $keys[wfMemcKey( 'limiter', $action, 'user', $id )] = $limits['user']; |
| 1149 | + $userLimit = $limits['user']; |
1149 | 1150 | } |
1150 | 1151 | if( $this->isNewbie() ) { |
1151 | 1152 | if( isset( $limits['newbie'] ) && $id != 0 ) { |
— | — | @@ -1159,6 +1160,20 @@ |
1160 | 1161 | $keys["mediawiki:limiter:$action:subnet:$subnet"] = $limits['subnet']; |
1161 | 1162 | } |
1162 | 1163 | } |
| 1164 | + // Check for group-specific permissions |
| 1165 | + // If more than one group applies, use the group with the highest limit |
| 1166 | + foreach ( $this->getGroups() as $group ) { |
| 1167 | + if ( isset( $limits[$group] ) ) { |
| 1168 | + if ( $userLimit === false || $limits[$group] > $userLimit ) { |
| 1169 | + $userLimit = $limits[$group]; |
| 1170 | + } |
| 1171 | + } |
| 1172 | + } |
| 1173 | + // Set the user limit key |
| 1174 | + if ( $userLimit !== false ) { |
| 1175 | + wfDebug( __METHOD__.": effective user limit: $userLimit\n" ); |
| 1176 | + $keys[ wfMemcKey( 'limiter', $action, 'user', $id ) ] = $userLimit; |
| 1177 | + } |
1163 | 1178 | |
1164 | 1179 | $triggered = false; |
1165 | 1180 | foreach( $keys as $key => $limit ) { |