r83780 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83779‎ | r83780 | r83781 >
Date:20:07, 12 March 2011
Author:bawolff
Status:ok (Comments)
Tags:
Comment:
(follow-up r83611) renaming variables from hungarian notation to normal standards.
Two variables were missed (they were missed consistantly, so didn't cause any problems)

Also add a comment to the namespace part, too clarify how its used in practise.
Modified paths:
  • /trunk/extensions/intersection/DynamicPageList.php (modified) (history)

Diff [purge]

Index: trunk/extensions/intersection/DynamicPageList.php
@@ -102,7 +102,7 @@
103103 $stable = $quality = 'include';
104104 $flaggedRevs = false;
105105
106 - $bNamespace = false;
 106+ $namespaceFiltering = false;
107107 $namespaceIndex = 0;
108108
109109 $offset = 0;
@@ -125,12 +125,12 @@
126126 $poptions = new ParserOptions;
127127
128128 foreach ( $parameters as $parameter ) {
129 - $aParam = explode( '=', $parameter, 2 );
130 - if( count( $aParam ) < 2 ) {
 129+ $paramField = explode( '=', $parameter, 2 );
 130+ if( count( $paramField ) < 2 ) {
131131 continue;
132132 }
133 - $type = trim( $aParam[0] );
134 - $arg = trim( $aParam[1] );
 133+ $type = trim( $paramField[0] );
 134+ $arg = trim( $paramField[1] );
135135 switch ( $type ) {
136136 case 'category':
137137 $title = Title::newFromText(
@@ -154,13 +154,20 @@
155155 $ns = $wgContLang->getNsIndex( $arg );
156156 if ( $ns != null ) {
157157 $namespaceIndex = $ns;
158 - $bNamespace = true;
 158+ $namespaceFiltering = true;
159159 } else {
 160+ // Note, since intval("some string") = 0
 161+ // this considers pretty much anything
 162+ // invalid here as the main namespace.
 163+ // This was probably originally a bug,
 164+ // but is now depended upon by people
 165+ // writing things like namespace=main
 166+ // so be careful when changing this code.
160167 $namespaceIndex = intval( $arg );
161168 if ( $namespaceIndex >= 0 ) {
162 - $bNamespace = true;
 169+ $namespaceFiltering = true;
163170 } else {
164 - $bNamespace = false;
 171+ $namespaceFiltering = false;
165172 }
166173 }
167174 break;
@@ -384,7 +391,7 @@
385392 $excludeCatCount = count( $excludeCategories );
386393 $totalCatCount = $catCount + $excludeCatCount;
387394
388 - if ( $catCount < 1 && false == $bNamespace ) {
 395+ if ( $catCount < 1 && false == $namespaceFiltering ) {
389396 if ( $suppressErrors == false ) {
390397 return htmlspecialchars( wfMsg( 'intersection_noincludecats' ) ); // "!!no included categories!!";
391398 } else {
@@ -437,7 +444,7 @@
438445 $fields[] = 'c1.cl_timestamp';
439446 }
440447
441 - if ( $bNamespace == true ) {
 448+ if ( $namespaceFiltering == true ) {
442449 $where['page_namespace'] = $namespaceIndex;
443450 }
444451

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83611Intersection/DynamicPageList: rename variables; we don't use Hungarian notationashley22:00, 9 March 2011

Comments

#Comment by Jack Phoenix (talk | contribs)   22:05, 12 March 2011

Good catch, thanks. :)

Status & tagging log