r52335 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52334‎ | r52335 | r52336 >
Date:00:37, 24 June 2009
Author:skizzerz
Status:ok (Comments)
Tags:
Comment:
* follow-up to r52301: make it more clear what this loop is trying to accomplish (per suggestion by werdna on IRC).
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -1494,8 +1494,14 @@
14951495 # Not a public wiki, so no shortcut
14961496 $useShortcut = false;
14971497 } elseif( !empty( $wgRevokePermissions ) ) {
1498 - foreach( array_keys( $wgRevokePermissions ) as $group ) {
1499 - if( !empty( $wgRevokePermissions[$group]['read'] ) ) {
 1498+ /*
 1499+ * Iterate through each group with permissions being revoked (key not included since we don't care
 1500+ * what the group name is), then check if the read permission is being revoked. If it is, then
 1501+ * we don't use the shortcut below since the user might not be able to read, even though anon
 1502+ * reading is allowed.
 1503+ */
 1504+ foreach( $wgRevokePermissions as $perms ) {
 1505+ if( !empty( $perms['read'] ) ) {
15001506 # We might be removing the read right from the user, so no shortcut
15011507 $useShortcut = false;
15021508 break;

Follow-up revisions

RevisionCommit summaryAuthorDate
r52511Merge r52335-r52510 from trunk.demon15:15, 28 June 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r52301* Revert r52201, but modify the shortcut code so that it properly detects "pu...skizzerz02:03, 23 June 2009

Comments

#Comment by Simetrical (talk | contribs)   01:21, 24 June 2009

Is the "if ( !empty( $wgRevokePermissions ) )" really useful here? foreach on an empty array should just do nothing anyway, right?

#Comment by Brion VIBBER (talk | contribs)   00:52, 24 August 2009

It's checking if the array sub-index 'read' is present and not empty (unset/null/false/0/empty string) (eg, that it's set to true), not if the entire array is empty.

#Comment by Simetrical (talk | contribs)   01:36, 24 August 2009

Are you referring to the same line that I am?

Status & tagging log