r88707 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88706‎ | r88707 | r88708 >
Date:01:08, 24 May 2011
Author:demon
Status:ok
Tags:
Comment:
MFT r88634
Modified paths:
  • /branches/wmf/1.17wmf1/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php
@@ -500,9 +500,9 @@
501501 * @param Title $title
502502 * @return Array of String: list of keywords
503503 */
504 - public function getKeywords ( $title ) {
 504+ public function getKeywords ( Title $title ) {
505505 wfProfileIn( __METHOD__ );
506 - $cats = $title->getParentCategories();
 506+ $cats = $this->getVisibleCategories( $title );
507507 $res = array();
508508
509509 # the following code is based (stolen) from r56954 of flagged revs.
@@ -519,7 +519,7 @@
520520 if ( !$targetTitle ) {
521521 continue;
522522 }
523 - $target = $targetTitle->getPrefixedDBkey();
 523+ $target = $targetTitle->getDBkey();
524524 $mapTo = trim( $mapping[1] );
525525
526526 if ( $mapTo === '__MASK__' ) {
@@ -530,7 +530,7 @@
531531 }
532532 }
533533 }
534 - foreach ( $cats as $cat => $val ) {
 534+ foreach ( $cats as $cat ) {
535535 if ( !isset( $catMask[$cat] ) ) {
536536 if ( isset( $catMap[$cat] ) ) {
537537 // Its mapped.
@@ -545,4 +545,48 @@
546546 wfProfileOut( __METHOD__ );
547547 return $res;
548548 }
 549+
 550+ /**
 551+ * Get all non-hidden categories for a title.
 552+ *
 553+ * Kind of similar to title::getParentCategories.
 554+ *
 555+ * @param Title $title Which title to get the categories for.
 556+ * @return Array of String's that are the (non-prefixed) db-keys of the cats.
 557+ */
 558+ private function getVisibleCategories ( Title $title ) {
 559+ $dbr = wfGetDB( DB_SLAVE );
 560+
 561+ $where = array(
 562+ 'cl_from' => $title->getArticleID(),
 563+ 'pp_propname' => null
 564+ );
 565+
 566+ $joins = array(
 567+ 'page' => array(
 568+ 'LEFT OUTER JOIN',
 569+ array( 'page_namespace' => NS_CATEGORY, 'page_title=cl_to' )
 570+ ),
 571+ 'page_props' => array(
 572+ 'LEFT OUTER JOIN',
 573+ array( 'pp_page=page_id', 'pp_propname' => 'hiddencat' )
 574+ )
 575+ );
 576+
 577+ $res = $dbr->select(
 578+ array( 'categorylinks', 'page', 'page_props' ),
 579+ 'cl_to',
 580+ $where,
 581+ __METHOD__,
 582+ array(), /* options */
 583+ $joins
 584+ );
 585+ $finalResult = array();
 586+ if ( $res !== false ) {
 587+ foreach( $res as $row ) {
 588+ $finalResult[] = $row->cl_to;
 589+ }
 590+ }
 591+ return $finalResult;
 592+ }
549593 }
Property changes on: branches/wmf/1.17wmf1/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php
___________________________________________________________________
Added: svn:mergeinfo
550594 Merged /branches/sqlite/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php:r58211-58321
551595 Merged /trunk/phase3/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php:r79828,79830,79848,79853,79950-79951,79954,79989,80006-80007,80013,80016,80080,80083,80124,80128,80238,80406,81833,83212,83590
552596 Merged /branches/new-installer/phase3/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php:r43664-66004
553597 Merged /branches/wmf-deployment/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php:r60970
554598 Merged /branches/REL1_15/phase3/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php:r51646
555599 Merged /branches/wmf/1.16wmf4/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php:r67177,69199,76243,77266
556600 Merged /trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php:r87153,87157,87236,87458,88402,88634

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88634Do not include hidden categories in the list of keywords on gnsm output.bawolff06:18, 23 May 2011

Status & tagging log