r48913 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48912‎ | r48913 | r48914 >
Date:11:46, 27 March 2009
Author:jojo
Status:ok
Tags:
Comment:
fix: allow adding of articles in categories that are not in NS_MAiN
Modified paths:
  • /trunk/extensions/Collection/Collection.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.body.php
@@ -418,6 +418,7 @@
419419 static function addCategory( $title ) {
420420 global $wgOut;
421421 global $wgCollectionMaxArticles;
 422+ global $wgCollectionArticleNamespaces;
422423
423424 $limit = $wgCollectionMaxArticles - self::countArticles();
424425 if ( $limit <= 0 ) {
@@ -435,7 +436,6 @@
436437 $where = array(
437438 'cl_from=page_id',
438439 'cl_to' => $title->getDBKey(),
439 - 'page_namespace' => NS_MAIN,
440440 );
441441 $res = $db->select( $tables, $fields, $where, __METHOD__, $options );
442442 $members = array();
@@ -446,9 +446,11 @@
447447 $limitExceeded = true;
448448 break;
449449 }
450 - $articleTitle = Title::makeTitle( $row->page_namespace, $row->page_title );
451 - if ( self::findArticle( $articleTitle->getPrefixedText() ) == -1 ) {
452 - self::addArticle( $articleTitle );
 450+ if ( in_array( $row->page_namespace, $wgCollectionArticleNamespaces ) ) {
 451+ $articleTitle = Title::makeTitle( $row->page_namespace, $row->page_title );
 452+ if ( self::findArticle( $articleTitle->getPrefixedText() ) == -1 ) {
 453+ self::addArticle( $articleTitle );
 454+ }
453455 }
454456 }
455457 $db->freeResult( $res );

Status & tagging log