Index: branches/wmf/1.17wmf1/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -475,6 +475,9 @@ |
476 | 476 | # Stable dump hook |
477 | 477 | $wgHooks['WikiExporter::dumpStableQuery'][] = 'FlaggedRevsHooks::stableDumpQuery'; |
478 | 478 | |
| 479 | +# GNSM category hooks |
| 480 | +$wgHooks['GoogleNewsSitemap::Query'][] = 'FlaggedRevsHooks::gnsmQueryModifier'; |
| 481 | + |
479 | 482 | # Duplicate flagged* tables in parserTests.php |
480 | 483 | $wgHooks['ParserTestTables'][] = 'FlaggedRevsHooks::onParserTestTables'; |
481 | 484 | # Integration tests |
Index: branches/wmf/1.17wmf1/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -2144,4 +2144,32 @@ |
2145 | 2145 | } |
2146 | 2146 | return true; |
2147 | 2147 | } |
| 2148 | + |
| 2149 | + public static function gnsmQueryModifier( array $params, array &$joins, array &$conditions ) { |
| 2150 | + $filterSet = array( GoogleNewsSitemap::OPT_ONLY, GoogleNewsSitemap::OPT_EXCLUDE ); |
| 2151 | + # Either involves the same JOIN here... |
| 2152 | + if ( isset( $filterSet[ $params['stable'] ] ) || isset( $filterSet[ $params['quality'] ] ) ) { |
| 2153 | + $joins['flaggedpages'] = array( 'LEFT JOIN', 'page_id = fp_page_id' ); |
| 2154 | + } |
| 2155 | + |
| 2156 | + switch( $params['stable'] ) { |
| 2157 | + case GoogleNewsSitemap::OPT_ONLY: |
| 2158 | + $conditions[] = 'fp_stable IS NOT NULL '; |
| 2159 | + break; |
| 2160 | + case GoogleNewsSitemap::OPT_EXCLUDE: |
| 2161 | + $conditions['fp_stable'] = null; |
| 2162 | + break; |
| 2163 | + } |
| 2164 | + |
| 2165 | + switch( $params['quality'] ) { |
| 2166 | + case GoogleNewsSitemap::OPT_ONLY: |
| 2167 | + $conditions[] = 'fp_quality >= 1'; |
| 2168 | + break; |
| 2169 | + case GoogleNewsSitemap::OPT_EXCLUDE: |
| 2170 | + $conditions['fp_quality'] = 0; |
| 2171 | + break; |
| 2172 | + } |
| 2173 | + |
| 2174 | + return true; |
| 2175 | + } |
2148 | 2176 | } |
Property changes on: branches/wmf/1.17wmf1/extensions/FlaggedRevs |
___________________________________________________________________ |
Modified: svn:mergeinfo |
2149 | 2177 | Merged /trunk/extensions/FlaggedRevs:r86451 |