r109710 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109709‎ | r109710 | r109711 >
Date:00:58, 22 January 2012
Author:reedy
Status:ok (Comments)
Tags:core 
Comment:
Add braces

Cache result of variable calls

Minor RELEASE-NOTES-1.19 updates
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRecentchangeslinked.php (modified) (history)
  • /trunk/phase3/maintenance/mctest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -117,9 +117,9 @@
118118 * (bug 33456) Show $wgQueryCacheLimit on cached query pages.
119119 * (bug 10574) Add an option to allow all pages to be exported by Special:Export.
120120 * mediawiki.js Message object constructor is now publicly available as mw.Message.
121 -* (bug 29309) allow CSS class per tooltip (tipsy)
 121+* (bug 29309) Allow CSS class per tooltip (tipsy).
122122 * (bug 33565) Add accesskey/tooltip to submit buttons on Special:EditWatchlist.
123 -* (bug 17959) Inline rendering/thumbnailing for Gimp XCF images
 123+* (bug 17959) Inline rendering/thumbnailing for Gimp XCF images.
124124 * (bug 32341) Add upload by URL domain limitation.
125125
126126 === Bug fixes in 1.19 ===
@@ -292,7 +292,7 @@
293293 been removed from wikibits.js
294294 * jquery.mwPrototypes module was renamed to jquery.mwExtension.
295295 * The maintenance script populateSha1.php was renamed to the more concise
296 - populateImageSha1.php
 296+ populateImageSha1.php.
297297 * The Client-IP header is no longer checked for when trying to resolve a client's
298298 real IP address.
299299 * (bug 22096) Although IE5.x and below was already unsupported officially, stylesheets
Index: trunk/phase3/includes/specials/SpecialRecentchangeslinked.php
@@ -69,13 +69,14 @@
7070 if ( $target === '' ) {
7171 return false;
7272 }
 73+ $outputPage = $this->getOutput();
7374 $title = Title::newFromURL( $target );
7475 if( !$title || $title->getInterwiki() != '' ){
75 - $this->getOutput()->wrapWikiMsg( "<div class=\"errorbox\">\n$1\n</div><br style=\"clear: both\" />", 'allpagesbadtitle' );
 76+ $outputPage->wrapWikiMsg( "<div class=\"errorbox\">\n$1\n</div><br style=\"clear: both\" />", 'allpagesbadtitle' );
7677 return false;
7778 }
7879
79 - $this->getOutput()->setPageTitle( $this->msg( 'recentchangeslinked-title', $title->getPrefixedText() ) );
 80+ $outputPage->setPageTitle( $this->msg( 'recentchangeslinked-title', $title->getPrefixedText() ) );
8081
8182 /*
8283 * Ordinary links are in the pagelinks table, while transclusions are
@@ -113,8 +114,9 @@
114115 $query_options, $opts['tagfilter'] );
115116 }
116117
117 - if ( !wfRunHooks( 'SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$select ) ) )
 118+ if ( !wfRunHooks( 'SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$select ) ) ) {
118119 return false;
 120+ }
119121
120122 if( $ns == NS_CATEGORY && !$showlinkedto ) {
121123 // special handling for categories
@@ -125,11 +127,14 @@
126128 // for now, always join on these tables; really should be configurable as in whatlinkshere
127129 $link_tables = array( 'pagelinks', 'templatelinks' );
128130 // imagelinks only contains links to pages in NS_FILE
129 - if( $ns == NS_FILE || !$showlinkedto ) $link_tables[] = 'imagelinks';
 131+ if( $ns == NS_FILE || !$showlinkedto ) {
 132+ $link_tables[] = 'imagelinks';
 133+ }
130134 }
131135
132 - if( $id == 0 && !$showlinkedto )
 136+ if( $id == 0 && !$showlinkedto ) {
133137 return false; // nonexistent pages can't link to any pages
 138+ }
134139
135140 // field name prefixes for all the various tables we might want to join with
136141 $prefix = array( 'pagelinks' => 'pl', 'templatelinks' => 'tl', 'categorylinks' => 'cl', 'imagelinks' => 'il' );
@@ -140,14 +145,20 @@
141146 $pfx = $prefix[$link_table];
142147
143148 // imagelinks and categorylinks tables have no xx_namespace field, and have xx_to instead of xx_title
144 - if( $link_table == 'imagelinks' ) $link_ns = NS_FILE;
145 - elseif( $link_table == 'categorylinks' ) $link_ns = NS_CATEGORY;
146 - else $link_ns = 0;
 149+ if( $link_table == 'imagelinks' ) {
 150+ $link_ns = NS_FILE;
 151+ } elseif( $link_table == 'categorylinks' ) {
 152+ $link_ns = NS_CATEGORY;
 153+ } else {
 154+ $link_ns = 0;
 155+ }
147156
148157 if( $showlinkedto ) {
149158 // find changes to pages linking to this page
150159 if( $link_ns ) {
151 - if( $ns != $link_ns ) continue; // should never happen, but check anyway
 160+ if( $ns != $link_ns ) {
 161+ continue;
 162+ } // should never happen, but check anyway
152163 $subconds = array( "{$pfx}_to" => $dbkey );
153164 } else {
154165 $subconds = array( "{$pfx}_namespace" => $ns, "{$pfx}_title" => $dbkey );
@@ -164,12 +175,12 @@
165176 }
166177 }
167178
168 - if( $dbr->unionSupportsOrderAndLimit())
 179+ if( $dbr->unionSupportsOrderAndLimit()) {
169180 $order = array( 'ORDER BY' => 'rc_timestamp DESC' );
170 - else
 181+ } else {
171182 $order = array();
 183+ }
172184
173 -
174185 $query = $dbr->selectSQLText(
175186 array_merge( $tables, array( $link_table ) ),
176187 $select,
@@ -185,11 +196,12 @@
186197 $subsql[] = $query;
187198 }
188199
189 - if( count($subsql) == 0 )
 200+ if( count($subsql) == 0 ) {
190201 return false; // should never happen
191 - if( count($subsql) == 1 && $dbr->unionSupportsOrderAndLimit() )
 202+ }
 203+ if( count($subsql) == 1 && $dbr->unionSupportsOrderAndLimit() ) {
192204 $sql = $subsql[0];
193 - else {
 205+ } else {
194206 // need to resort and relimit after union
195207 $sql = $dbr->unionQueries($subsql, false).' ORDER BY rc_timestamp DESC';
196208 $sql = $dbr->limitResult($sql, $limit, false);
@@ -197,12 +209,17 @@
198210
199211 $res = $dbr->query( $sql, __METHOD__ );
200212
201 - if( $res->numRows() == 0 )
 213+ if( $res->numRows() == 0 ) {
202214 $this->mResultEmpty = true;
 215+ }
203216
204217 return $res;
205218 }
206219
 220+ /**
 221+ * @param $opts FormOptions
 222+ * @return array
 223+ */
207224 function getExtraOptions( $opts ){
208225 $opts->consumeValues( array( 'showlinkedto', 'target', 'tagfilter' ) );
209226 $extraOpts = array();
@@ -212,8 +229,9 @@
213230 Xml::check( 'showlinkedto', $opts['showlinkedto'], array('id' => 'showlinkedto') ) . ' ' .
214231 Xml::label( wfMsg("recentchangeslinked-to"), 'showlinkedto' ) );
215232 $tagFilter = ChangeTags::buildTagFilterSelector( $opts['tagfilter'] );
216 - if ($tagFilter)
 233+ if ($tagFilter) {
217234 $extraOpts['tagfilter'] = $tagFilter;
 235+ }
218236 return $extraOpts;
219237 }
220238
Index: trunk/phase3/maintenance/mctest.php
@@ -36,8 +36,9 @@
3737 global $wgMemCachedServers;
3838
3939 $iterations = $this->getOption( 'i', 100 );
40 - if ( $this->hasArg() )
 40+ if ( $this->hasArg() ) {
4141 $wgMemCachedServers = array( $this->getArg() );
 42+ }
4243
4344 foreach ( $wgMemCachedServers as $server ) {
4445 $this->output( $server . " ", $server );

Comments

#Comment by Nikerabbit (talk | contribs)   14:34, 22 January 2012

Grr.

Status & tagging log