From 61b0b776357bb39f80072b8ed0d1edb4cab534a1 Mon Sep 17 00:00:00 2001 From: "This, that and the other" Date: Tue, 2 Feb 2016 01:16:08 +1100 Subject: [PATCH] fix hardcoded limit on titles in Special:Export In Special:Export if you enter a category in the "Add pages from category" textbox, there was a hardcoded limit of 5000 page titles in the function getPagesFromCategory(). The same is true for a similar function fetching pages by namespace instead of category, function getPagesFromNamespace(). I have a couple of wikis where we wish to export a nummber of pages exceeding 5000, so this is inconvenient. In this commit, I have introduced one new global configuration variable: $wgExportPagelistLimit. This new configuration variable has had its default set in includes/DefaultSettings.php to the values the two affected functions were hardcoded to prior to this patch; 5000 in both instances. This way, I can adjust the number of pages returned in the Special:Export page by adjusting the above new variable in LocalSettings.php. Change-Id: I6ca9e26eb6bc4a7a2bafd73b9460f445940c8ecb --- includes/DefaultSettings.php | 8 ++++++++ includes/specials/SpecialExport.php | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 4aed617007..f30854aaf1 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -6602,6 +6602,14 @@ $wgExportFromNamespaces = false; */ $wgExportAllowAll = false; +/** + * Maximum number of pages returned by the GetPagesFromCategory and + * GetPagesFromNamespace functions. + * + * @since 1.27 + */ +$wgExportPagelistLimit = 5000; + /** @} */ # end of import/export } /*************************************************************************//** diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index 3ce9c76a8e..f9b50504f5 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -418,6 +418,8 @@ class SpecialExport extends SpecialPage { private function getPagesFromCategory( $title ) { global $wgContLang; + $maxPages = $this->getConfig()->get( 'ExportPagelistLimit' ); + $name = $title->getDBkey(); $dbr = wfGetDB( DB_SLAVE ); @@ -426,7 +428,7 @@ class SpecialExport extends SpecialPage { array( 'page_namespace', 'page_title' ), array( 'cl_from=page_id', 'cl_to' => $name ), __METHOD__, - array( 'LIMIT' => '5000' ) + array( 'LIMIT' => $maxPages ) ); $pages = array(); @@ -451,13 +453,15 @@ class SpecialExport extends SpecialPage { private function getPagesFromNamespace( $nsindex ) { global $wgContLang; + $maxPages = $this->getConfig()->get( 'ExportPagelistLimit' ); + $dbr = wfGetDB( DB_SLAVE ); $res = $dbr->select( 'page', array( 'page_namespace', 'page_title' ), array( 'page_namespace' => $nsindex ), __METHOD__, - array( 'LIMIT' => '5000' ) + array( 'LIMIT' => $maxPages ) ); $pages = array(); -- 2.20.1