r75913 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75912‎ | r75913 | r75914 >
Date:12:03, 3 November 2010
Author:reedy
Status:ok
Tags:
Comment:
Fixup some assignments in conditionals
Modified paths:
  • /trunk/extensions/CentralAuth/SpecialGlobalUsers.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php (modified) (history)
  • /trunk/extensions/OAI/OAIHarvest.php (modified) (history)
  • /trunk/extensions/OAI/OAIRepo_body.php (modified) (history)
  • /trunk/extensions/ProofreadPage/ProofreadPage_body.php (modified) (history)
  • /trunk/extensions/ReaderFeedback/specialpages/RatingHistory_body.php (modified) (history)
  • /trunk/extensions/wikihiero/index.php (modified) (history)
  • /trunk/extensions/wikihiero/wh_generate.php (modified) (history)
  • /trunk/extensions/wikihiero/wh_table.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OAI/OAIRepo_body.php
@@ -460,7 +460,8 @@
461461 $rows[] = $row;
462462 $this->_lastSequence = $row->up_sequence;
463463 }
464 - if( $row = $resultSet->fetchObject() ) {
 464+ $row = $resultSet->fetchObject();
 465+ if( $row ) {
465466 $limit = wfTimestamp( TS_MW, $until );
466467 if( $until )
467468 $nextToken = "$metadataPrefix:$row->up_sequence:$limit";
Index: trunk/extensions/OAI/OAIHarvest.php
@@ -94,9 +94,10 @@
9595
9696 $xp = new DOMXPath( $doc );
9797 $xp->registerNamespace( 'oai', 'http://www.openarchives.org/OAI/2.0/' );
98 -
99 - if( $errors = $this->checkResponseErrors( $xp ) )
 98+ $errors = $this->checkResponseErrors( $xp );
 99+ if( $errors ) {
100100 return $errors;
 101+ }
101102
102103 $resultSet = $xp->query( '/oai:OAI-PMH/oai:ListRecords/oai:record' );
103104 foreach( $resultSet as $node ) {
Index: trunk/extensions/ProofreadPage/ProofreadPage_body.php
@@ -1226,7 +1226,8 @@
12271227 $pr_index = $dbr->tableName( 'pr_index' );
12281228 $query = "SELECT * FROM $pr_index WHERE pr_page_id=" . $index_id;
12291229 $res = $dbr->query( $query, __METHOD__ );
1230 - if( $x = $dbr->fetchObject( $res ) ) {
 1230+ $x = $dbr->fetchObject( $res );
 1231+ if( $x ) {
12311232 $n = $x->pr_count;
12321233 $n0 = $x->pr_q0;
12331234 $n1 = $x->pr_q1;
Index: trunk/extensions/wikihiero/wh_table.php
@@ -72,8 +72,8 @@
7373 <?php
7474
7575 echo "<b>" . htmlspecialchars( $table ) . "</b> - ".WH_Text($table)."<br /><br />";
76 -
77 - if($dh = opendir(WH_IMG_DIR)) {
 76+ $dh = opendir(WH_IMG_DIR);
 77+ if( $dh ) {
7878 while(($file = readdir($dh)) !== false) {
7979 if($table == "All")
8080 {
Index: trunk/extensions/wikihiero/index.php
@@ -154,7 +154,8 @@
155155 else
156156 echo "<a href=\"javascript:LangLink('".key($wh_language['Lang'])."');\">$l</a>";
157157 next($wh_language['Lang']);
158 - if($l = current($wh_language['Lang']))
 158+ $l = current($wh_language['Lang']);
 159+ if( $l )
159160 echo " | ";
160161 }
161162 ?>]</SMALL>
Index: trunk/extensions/wikihiero/wh_generate.php
@@ -57,7 +57,8 @@
5858
5959 if(is_dir($img_dir))
6060 {
61 - if ($dh = opendir($img_dir))
 61+ $dh = opendir($img_dir);
 62+ if ( $dh )
6263 {
6364 while (($file = readdir($dh)) !== false)
6465 {
Index: trunk/extensions/CentralAuth/SpecialGlobalUsers.php
@@ -14,10 +14,12 @@
1515 if ( $par ) {
1616 $pg->setGroup( $par );
1717 }
18 - if ( $rqGroup = $wgRequest->getVal( 'group' ) ) {
 18+ $rqGroup = $wgRequest->getVal( 'group' );
 19+ if ( $rqGroup ) {
1920 $pg->setGroup( $rqGroup );
2021 }
21 - if ( $rqUsername = $wgContLang->ucfirst( $wgRequest->getVal( 'username' ) ) ) {
 22+ $rqUsername = $wgContLang->ucfirst( $wgRequest->getVal( 'username' ) )
 23+ if ( $rqUsername ) {
2224 $pg->setUsername( $rqUsername );
2325 }
2426
Index: trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php
@@ -213,7 +213,8 @@
214214 return 'review_param_missing'; // user didn't say
215215 }
216216 # Fill in implicit tag data for binary flag case
217 - if ( $iDims = $this->implicitDims() ) {
 217+ $iDims = $this->implicitDims();
 218+ if ( $iDims ) {
218219 $this->dims = $iDims;
219220 } else {
220221 foreach ( FlaggedRevs::getDimensions() as $tag => $levels ) {
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -777,7 +777,8 @@
778778 # Determine timestamp. A reviewed version may have explicitly been requested...
779779 $frev = null;
780780 $time = false;
781 - if ( $reqId = $wgRequest->getVal( 'stableid' ) ) {
 781+ $reqId = $wgRequest->getVal( 'stableid' );
 782+ if ( $reqId ) {
782783 $frev = FlaggedRevision::newFromTitle( $this->article->getTitle(), $reqId );
783784 } elseif ( $this->pageOverride() ) {
784785 $frev = $this->article->getStableRev();
Index: trunk/extensions/ReaderFeedback/specialpages/RatingHistory_body.php
@@ -169,8 +169,11 @@
170170 $table = fread( $fp, filesize($filePath) );
171171 fclose( $fp );
172172 $html .= '<h2>' . wfMsgHtml("readerfeedback-$tag") . '</h2>' . $table . "\n";
173 - } elseif( $table = $this->makeHTMLTable( $tag, $filePath ) ) {
174 - $html .= '<h2>' . wfMsgHtml("readerfeedback-$tag") . '</h2>' . $table . "\n";
 173+ } else {
 174+ $table = $this->makeHTMLTable( $tag, $filePath );
 175+ if( $table ) {
 176+ $html .= '<h2>' . wfMsgHtml("readerfeedback-$tag") . '</h2>' . $table . "\n";
 177+ }
175178 }
176179 break;
177180 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r75924Minor followup to r75913, add missing ;reedy13:02, 3 November 2010

Status & tagging log