* (bug 22353) Categorised recent changes now works again
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 4 Mar 2010 15:42:17 +0000 (15:42 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 4 Mar 2010 15:42:17 +0000 (15:42 +0000)
RELEASE-NOTES
includes/specials/SpecialRecentchanges.php

index c3415c4..b07eb68 100644 (file)
@@ -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 <noinclude>, <includeonly> 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 ==
 
index 5088004..26ff43b 100644 (file)
@@ -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;