r87236 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87235‎ | r87236 | r87237 >
Date:05:46, 2 May 2011
Author:bawolff
Status:ok
Tags:
Comment:
Fix GoogleNewsSitemap flagged revs support, which was rather broken.

*The joins array was declared twice, resetting anything set the first time.
*The quality pages option wasn't behaving as documented. This was a bug originally in DPL, probably got
copy pasted here long ago.
*The flagged revision table also needs to be added to the table array
*(follow-up r86451) minor issue with testing against the array key vs array value when determining if the
flagged revs table should be joined.

Clearly I did not do a very good job of testing the flagged revs part of this extension.
Modified paths:
  • /trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php
@@ -270,13 +270,13 @@
271271 // so this can't ever work with uncategorized articles
272272 $fields = array( 'page_namespace', 'page_title', 'page_id', 'c1.cl_timestamp' );
273273 $conditions = array();
 274+ $joins = array();
274275
275276 if ( $params['namespace'] !== false ) {
276277 $conditions['page_namespace'] = $params['namespace'];
277278 }
278279
279 - $joins = array();
280 - wfRunHooks('GoogleNewsSitemap::Query', array($params, &$joins, &$conditions));
 280+ wfRunHooks('GoogleNewsSitemap::Query', array($params, &$joins, &$conditions, &$tables));
281281
282282 switch ( $params['redirects'] ) {
283283 case self::OPT_ONLY:
@@ -307,7 +307,6 @@
308308 $currentTableNumber = 1;
309309 $categorylinks = $dbr->tableName( 'categorylinks' );
310310
311 - $joins = array();
312311 for ( $i = 0; $i < $params['catCount']; $i++ ) {
313312 $joins["$categorylinks AS c$currentTableNumber"] = array( 'INNER JOIN',
314313 array( "page_id = c{$currentTableNumber}.cl_from",
Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevs.hooks.php
@@ -1001,10 +1001,13 @@
10021002 return false; // final
10031003 }
10041004
1005 - public static function gnsmQueryModifier( array $params, array &$joins, array &$conditions ) {
1006 - $filterSet = array( GoogleNewsSitemap::OPT_ONLY, GoogleNewsSitemap::OPT_EXCLUDE );
 1005+ public static function gnsmQueryModifier( array $params, array &$joins, array &$conditions, array &$tables ) {
 1006+ $filterSet = array( GoogleNewsSitemap::OPT_ONLY => true,
 1007+ GoogleNewsSitemap::OPT_EXCLUDE => true
 1008+ );
10071009 # Either involves the same JOIN here...
10081010 if ( isset( $filterSet[ $params['stable'] ] ) || isset( $filterSet[ $params['quality'] ] ) ) {
 1011+ $tables[] = 'flaggedpages';
10091012 $joins['flaggedpages'] = array( 'LEFT JOIN', 'page_id = fp_page_id' );
10101013 }
10111014
@@ -1022,7 +1025,7 @@
10231026 $conditions[] = 'fp_quality >= 1';
10241027 break;
10251028 case GoogleNewsSitemap::OPT_EXCLUDE:
1026 - $conditions['fp_quality'] = 0;
 1029+ $conditions[] = 'fp_quality = 0 OR fp_quality IS NULL';
10271030 break;
10281031 }
10291032

Follow-up revisions

RevisionCommit summaryAuthorDate
r87311MFT r87157, r87236demon01:29, 3 May 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86451* Move FlaggedRevs integration for GNSM to a hook that FlaggedRevs can use...mah02:38, 20 April 2011

Status & tagging log