r83805 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83804‎ | r83805 | r83806 >
Date:03:23, 13 March 2011
Author:bawolff
Status:ok
Tags:
Comment:
remove $wgDPLminResultCount. Why would you want to configure the minimun number of results? It should always be 1.
Remove the duplication with $this->params['dbr'] vs $dbr weirdness.
There are some minor whitespace changes which i probably should have put in a different commit (sorry!)
Modified paths:
  • /trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php
@@ -46,7 +46,6 @@
4747 **/
4848 var $wgDPlminCategories = 1; // Minimum number of categories to look for
4949 var $wgDPlmaxCategories = 6; // Maximum number of categories to look for
50 - var $wgDPLminResultCount = 1; // Minimum number of results to allow
5150 var $wgDPLmaxResultCount = 50; // Maximum number of results to allow
5251
5352 /**
@@ -153,7 +152,7 @@
154153
155154 $dbr = wfGetDB( DB_SLAVE );
156155
157 - $tables[]=$dbr->tableName( 'page' );
 156+ $tables[] = $dbr->tableName( 'page' );
158157
159158 //this is a little hacky, c1 is dynamically defined as the first category
160159 //so this can't ever work with uncategorized articles
@@ -218,10 +217,10 @@
219218 /*
220219 for ( $i = 0; $i < $this->params['notCatCount']; $i++ ) {
221220 // echo "notCategory parameter $i<br />\n";
222 - $sqlSelectFrom .= ' LEFT OUTER JOIN ' . $this->params['dbr']->tableName( 'categorylinks' );
 221+ $sqlSelectFrom .= ' LEFT OUTER JOIN ' . $dbr->tableName( 'categorylinks' );
223222 $sqlSelectFrom .= ' AS c' . ( $currentTableNumber + 1 ) . ' ON page_id = c' . ( $currentTableNumber + 1 );
224223 $sqlSelectFrom .= '.cl_from AND c' . ( $currentTableNumber + 1 );
225 - $sqlSelectFrom .= '.cl_to=' . $this->params['dbr']->addQuotes( $this->notCategories[$i]->getDBkey() );
 224+ $sqlSelectFrom .= '.cl_to=' . $dbr->addQuotes( $this->notCategories[$i]->getDBkey() );
226225
227226 $conditions .= ' AND c' . ( $currentTableNumber + 1 ) . '.cl_to IS NULL';
228227
@@ -269,21 +268,22 @@
270269
271270 // FIXME:notcats
272271 // $this->notCategories[] = $wgRequest->getArray('notcategory');
273 - $this->params['nameSpace'] = $wgContLang->getNsIndex( $wgRequest->getVal( 'namespace', 0 ) );
274 - $this->params['count'] = $wgRequest->getInt( 'count', $this->wgDPLmaxResultCount );
 272+ $this->params['nameSpace'] = $wgContLang->getNsIndex( $wgRequest->getVal( 'namespace', 0 ) );
 273+ $this->params['count'] = $wgRequest->getInt( 'count', $this->wgDPLmaxResultCount );
 274+
275275 if ( ( $this->params['count'] > $this->wgDPLmaxResultCount )
276 - || ( $this->params['count'] < $this->wgDPLminResultCount ) ) {
 276+ || ( $this->params['count'] < 1 ) ) {
277277 $this->params['count'] = $this->wgDPLmaxResultCount;
278278 }
279279
280 - $this->params['order'] = $wgRequest->getVal( 'order', 'descending' );
 280+ $this->params['order'] = $wgRequest->getVal( 'order', 'descending' );
281281 $this->params['orderMethod'] = $wgRequest->getVal( 'ordermethod', 'categoryadd' );
282 - $this->params['redirects'] = $wgRequest->getVal( 'redirects', 'exclude' );
283 - $this->params['stable'] = $wgRequest->getVal( 'stable', 'only' );
284 - $this->params['quality'] = $wgRequest->getVal( 'qualitypages', 'only' );
 282+ $this->params['redirects'] = $wgRequest->getVal( 'redirects', 'exclude' );
 283+ $this->params['stable'] = $wgRequest->getVal( 'stable', 'only' );
 284+ $this->params['quality'] = $wgRequest->getVal( 'qualitypages', 'only' );
285285 $this->params['suppressErrors'] = $wgRequest->getBool( 'supresserrors', false );
286286 $this->params['useNameSpace'] = $wgRequest->getBool( 'usenamespace', false );
287 - $this->params['useCurId'] = $wgRequest->getBool( 'usecurid', false );
 287+ $this->params['useCurId'] = $wgRequest->getBool( 'usecurid', false );
288288 $this->params['feed'] = $wgRequest->getVal( 'feed', 'sitemap' );
289289
290290 $this->params['catCount'] = count( $this->categories );
@@ -311,7 +311,6 @@
312312 $this->params['addFirstCategoryDate'] = false;
313313 }
314314
315 - $this->params['dbr'] =& wfGetDB( DB_SLAVE );
316315 }
317316
318317 function feedItemAuthor( $row ) {

Status & tagging log