From 3cef351f22f779b28e4b0b53649ce5f075c43cc7 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 4 Mar 2010 15:42:17 +0000 Subject: [PATCH] * (bug 22353) Categorised recent changes now works again --- RELEASE-NOTES | 5 +++-- includes/specials/SpecialRecentchanges.php | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c3415c462c..b07eb6869c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -38,8 +38,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN when the address changed * (bug 22664) Special:Userrights now accepts '0' as a valid user name * (bug 5210) preload parser now parses , and redirects -* (bug 22709) IIS7 mishandles redirects generated by OutputPage::output() when -the URL contains a colon. +* (bug 22709) IIS7 mishandles redirects generated by OutputPage::output() when + the URL contains a colon. +* (bug 22353) Categorised recent changes now works again == API changes in 1.17 == diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 5088004120..26ff43b47c 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -564,9 +564,9 @@ class SpecialRecentChanges extends SpecialPage { * @param $opts FormOptions */ function filterByCategories( &$rows, FormOptions $opts ) { - $categories = array_map( 'trim', explode( "|" , $opts['categories'] ) ); + $categories = array_map( 'trim', explode( '|' , $opts['categories'] ) ); - if( empty($categories) ) { + if( !count( $categories ) ) { return; } @@ -574,32 +574,34 @@ class SpecialRecentChanges extends SpecialPage { $cats = array(); foreach( $categories as $cat ) { $cat = trim( $cat ); - if( $cat == "" ) continue; + if( $cat == '' ) continue; $cats[] = $cat; } # Filter articles $articles = array(); $a2r = array(); + $rowsarr = array(); foreach( $rows AS $k => $r ) { $nt = Title::makeTitle( $r->rc_namespace, $r->rc_title ); $id = $nt->getArticleID(); if( $id == 0 ) continue; # Page might have been deleted... - if( !in_array($id, $articles) ) { + if( !in_array( $id, $articles ) ) { $articles[] = $id; } - if( !isset($a2r[$id]) ) { + if( !isset( $a2r[$id] ) ) { $a2r[$id] = array(); } $a2r[$id][] = $k; + $rowsarr[$k] = $r; } # Shortcut? - if( !count($articles) || !count($cats) ) + if( !count( $articles ) || !count( $cats ) ) return ; # Look up - $c = new Categoryfinder ; + $c = new Categoryfinder; $c->seed( $articles, $cats, $opts['categories_any'] ? "OR" : "AND" ) ; $match = $c->run(); @@ -608,7 +610,7 @@ class SpecialRecentChanges extends SpecialPage { foreach( $match AS $id ) { foreach( $a2r[$id] AS $rev ) { $k = $rev; - $newrows[$k] = $rows[$k]; + $newrows[$k] = $rowsarr[$k]; } } $rows = $newrows; -- 2.20.1