From: Brion Vibber Date: Mon, 20 Jul 2009 02:47:48 +0000 (+0000) Subject: * (bug 17374) Special:Export no longer exports multiple copies of pages X-Git-Tag: 1.31.0-rc.0~40810 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27votes%27%2C%20votes=%27waiting%27%29%20%7D%7D?a=commitdiff_plain;h=3bfccc2f8af31a1b09045df1965719b3028c8d03;p=lhc%2Fweb%2Fwiklou.git * (bug 17374) Special:Export no longer exports multiple copies of pages Proper normalization now! Only keeps one copy of each normalized page title; also now discarding interwikis explicitly. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c2632a4500..7d9e4d8e71 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index 8a40e2924b..fef4a4bfb6 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -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 ); }