* (bug 17374) Special:Export no longer exports multiple copies of pages
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 20 Jul 2009 02:47:48 +0000 (02:47 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 20 Jul 2009 02:47:48 +0000 (02:47 +0000)
Proper normalization now! Only keeps one copy of each normalized page title; also now discarding interwikis explicitly.

RELEASE-NOTES
includes/specials/SpecialExport.php

index c2632a4..7d9e4d8 100644 (file)
@@ -301,6 +301,7 @@ this. Was used when mwEmbed was going to be an extension.
 * (bug 17139) ts_resortTable inconsistent trimming makes date sorting fragile
 * (bug 19445) Change oldimage table to use ON UPDATE CASCADE for FK to image table.
 * (bug 14080) Short notation links to subpages didn't work in edit summaries
+* (bug 17374) Special:Export no longer exports multiple copies of pages
 
 == API changes in 1.16 ==
 
index 8a40e29..fef4a4b 100644 (file)
@@ -191,10 +191,22 @@ class SpecialExport extends SpecialPage {
        private function doExport( $page, $history, $list_authors ) {
                global $wgExportMaxHistory;
                
-               /* Split up the input and look up linked pages */
-               $inputPages = array_filter( explode( "\n", $page ), array( $this, 'filterPage' ) );
-               $pageSet = array_flip( $inputPages );
+               $pageSet = array(); // Inverted index of all pages to look up
                
+               // Split up and normalize input
+               foreach( explode( "\n", $page ) as $pageName ) {
+                       $pageName = trim( $pageName );
+                       $title = Title::newFromText( $pageName );
+                       if( $title && $title->getInterwiki() == '' && $title->getText() != '' ) {
+                               // Only record each page once!
+                               $pageSet[$title->getPrefixedText()] = true;
+                       }
+               }
+               
+               // Set of original pages to pass on to further manipulation...
+               $inputPages = array_keys( $pageSet );
+               
+               // Look up any linked pages if asked...
                if( $this->templates ) {
                        $pageSet = $this->getTemplates( $inputPages, $pageSet );
                }