fix hardcoded limit on titles in Special:Export
authorThis, that and the other <at.light@live.com.au>
Mon, 1 Feb 2016 14:16:08 +0000 (01:16 +1100)
committerTTO <at.light@live.com.au>
Tue, 2 Feb 2016 02:20:32 +0000 (02:20 +0000)
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
includes/specials/SpecialExport.php

index 4aed617..f30854a 100644 (file)
@@ -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 }
 
 /*************************************************************************//**
index 3ce9c76..f9b5050 100644 (file)
@@ -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();