r75441 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75440‎ | r75441 | r75442 >
Date:16:53, 26 October 2010
Author:reedy
Status:ok
Tags:
Comment:
Swap some while loops for foreach. Fixup some calls to deprecated method calls
Modified paths:
  • /trunk/extensions/CodeReview/api/ApiCodeRevisions.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)
  • /trunk/extensions/CodeReview/svnImport.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeReleaseNotes.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionListView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/SpecialRepoAdmin.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -360,7 +360,7 @@
361361 }
362362
363363 //Notify commenters and revision author of followup revision
364 - foreach ( $users as $userId => $user ) {
 364+ foreach ( $users as $user ) {
365365 // Notify user with its own message if he already want
366366 // to be CCed of all emails it sends.
367367 if ( $commitAuthorId == $user->getId() ) {
Index: trunk/extensions/CodeReview/svnImport.php
@@ -141,7 +141,7 @@
142142 __METHOD__,
143143 $options
144144 );
145 - while ( $row = $dbw->fetchObject( $res ) ) {
 145+ foreach ( $res as $row ) {
146146 $repo->getRevision( $row->cr_id );
147147 $repo->getDiff( $row->cr_id ); // trigger caching
148148 $this->output( "Diff r{$row->cr_id} done\n" );
Index: trunk/extensions/CodeReview/api/ApiCodeRevisions.php
@@ -31,7 +31,7 @@
3232
3333 public function execute() {
3434 global $wgUser;
35 - $this->getMain()->setVaryCookie();
 35+ $this->getMain()->setCacheMode( 'anon-public-user-private' );
3636 // Before doing anything at all, let's check permissions
3737 if ( !$wgUser->isAllowed( 'codereview-use' ) ) {
3838 $this->dieUsage( 'You don\'t have permission to view code revisions', 'permissiondenied' );
Index: trunk/extensions/CodeReview/ui/SpecialRepoAdmin.php
@@ -37,7 +37,7 @@
3838 global $wgScript;
3939 return Xml::fieldset( wfMsg( 'repoadmin-new-legend' ) ) .
4040 Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
41 - Xml::hidden( 'title', $this->mPage->getTitle()->getPrefixedDBKey() ) .
 41+ Html::hidden( 'title', $this->mPage->getTitle()->getPrefixedDBKey() ) .
4242 Xml::inputLabel( wfMsg( 'repoadmin-new-label' ), 'repo', 'repo' ) .
4343 Xml::submitButton( wfMsg( 'repoadmin-new-button' ) ) .
4444 '</form></fieldset>';
@@ -114,7 +114,7 @@
115115 Xml::input( 'wpBugPath', 60, $bugPath ),
116116 'repoadmin-edit-view' =>
117117 Xml::input( 'wpViewPath', 60, $viewPath ) ) ) .
118 - Xml::hidden( 'wpEditToken', $wgUser->editToken( $this->mRepoName ) ) .
 118+ Html::hidden( 'wpEditToken', $wgUser->editToken( $this->mRepoName ) ) .
119119 Xml::submitButton( wfMsg( 'repoadmin-edit-button' ) ) .
120120 '</form></fieldset>'
121121 );
Index: trunk/extensions/CodeReview/ui/CodeRevisionListView.php
@@ -71,7 +71,7 @@
7272 $dbr = wfGetDB( DB_SLAVE );
7373 $revObjects = array();
7474 $res = $dbr->select( 'code_rev', '*', array( 'cr_id' => $revisions, 'cr_repo_id' => $this->mRepo->getId() ), __METHOD__ );
75 - while ( $row = $dbr->fetchObject( $res ) ) {
 75+ foreach ($res as $row ) {
7676 $revObjects[] = CodeRevision::newFromRow( $this->mRepo, $row );
7777 }
7878
@@ -81,14 +81,14 @@
8282 $addTags = array_map( 'trim', explode( ",", $addTags ) );
8383 $removeTags = array_map( 'trim', explode( ",", $removeTags ) );
8484
85 - foreach ( $revObjects as $id => $rev ) {
 85+ foreach ( $revObjects as $rev ) {
8686 $rev->changeTags( $addTags, $removeTags, $wgUser );
8787 }
8888 }
8989
9090 if ( $wgUser->isAllowed( 'codereview-set-status' ) &&
9191 $revObjects && $revObjects[0]->isValidStatus( $status ) ) {
92 - foreach ( $revObjects as $id => $rev ) {
 92+ foreach ( $revObjects as $rev ) {
9393 $rev->setStatus( $status, $wgUser );
9494 }
9595 }
@@ -160,10 +160,10 @@
161161 Xml::span( $this->mAppliedFilter, '' ) . '</strong>&#160;' .
162162 Xml::submitButton( wfMsg( 'code-revfilter-clear' ) ) .
163163 '</td>' .
164 - Xml::hidden( 'title', SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() ) )
 164+ Html::hidden( 'title', SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() ) )
165165 );
166166 } else {
167 - $wgOut->addHTML( Xml::hidden( 'title', $special->getPrefixedDBKey() ) );
 167+ $wgOut->addHTML( Html::hidden( 'title', $special->getPrefixedDBKey() ) );
168168 }
169169 $wgOut->addHTML( "</tr></table></fieldset>" . Xml::closeElement( 'form' ) );
170170 }
Index: trunk/extensions/CodeReview/ui/CodeReleaseNotes.php
@@ -44,7 +44,7 @@
4545 $wgOut->addHTML(
4646 Xml::openElement( 'form', array( 'action' => $wgScript, 'method' => 'get' ) ) .
4747 "<fieldset><legend>" . wfMsgHtml( 'code-release-legend' ) . "</legend>" .
48 - Xml::hidden( 'title', $special->getPrefixedDBKey() ) . '<b>' .
 48+ Html::hidden( 'title', $special->getPrefixedDBKey() ) . '<b>' .
4949 Xml::inputlabel( wfMsg( "code-release-startrev" ), 'startrev', 'startrev', 10, $this->mStartRev ) .
5050 '</b>&#160;' .
5151 Xml::inputlabel( wfMsg( "code-release-endrev" ), 'endrev', 'endrev', 10, $this->mEndRev ) .
@@ -86,7 +86,7 @@
8787 );
8888 $wgOut->addHTML( '<ul>' );
8989 # Output any relevant seeming commits...
90 - while ( $row = $dbr->fetchObject( $res ) ) {
 90+ foreach ( $res as $row ) {
9191 $summary = htmlspecialchars( $row->cr_message );
9292 # Add this commit summary if needed.
9393 if ( $row->rnotes || $this->isRelevant( $summary ) ) {
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php
@@ -615,9 +615,9 @@
616616 }
617617 return '<div class="mw-codereview-post-comment">' .
618618 $preview .
619 - Xml::hidden( 'wpEditToken', $wgUser->editToken() ) .
620 - Xml::hidden( 'path', $this->mPath ) .
621 - ( $parent ? Xml::hidden( 'wpParent', $parent ) : '' ) .
 619+ Html::hidden( 'wpEditToken', $wgUser->editToken() ) .
 620+ Html::hidden( 'path', $this->mPath ) .
 621+ ( $parent ? Html::hidden( 'wpParent', $parent ) : '' ) .
622622 '<div>' .
623623 Xml::openElement( 'textarea', array(
624624 'name' => "wpReply{$parent}",

Status & tagging log