* (bug 13298) Tighter limits on Special:Newpages limits when embedding
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 13 Mar 2008 18:45:33 +0000 (18:45 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 13 Mar 2008 18:45:33 +0000 (18:45 +0000)
RELEASE-NOTES
includes/SpecialNewpages.php

index c2888ad..375b950 100644 (file)
@@ -83,6 +83,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 8157) Remove redirects from Special:Unusedtemplates. Patch by WebBoy.
 * (bug 10721) Duplicate section anchors with differing case now disambiguated
   for Internet Explorer's sake
+* (bug 13298) Tighter limits on Special:Newpages limits when embedding
 
 
 === API changes in 1.13 ===
index 1c3bee8..16b5642 100644 (file)
@@ -41,6 +41,20 @@ class NewPagesPage extends QueryPage {
                        /* int  */ 'offset' => 0,
                        /* int  */ 'limit' => 50,
                );
+               
+               if( $shownavigation ) {
+                       // Some hopefully reasonable limits...
+                       $max = array(
+                               /* int */ 'offset' => 5000,
+                               /* int */ 'limit' => 500,
+                       );
+               } else {
+                       // Embedded? Be a lot more strict...
+                       $max = array(
+                               /* int */ 'offset' => 0,
+                               /* int */ 'limit' => 200,
+                       );
+               }
 
                $options = $defaults;
 
@@ -87,10 +101,16 @@ class NewPagesPage extends QueryPage {
                if ( $options['limit'] <= 0 ) {
                        $options['limit'] = $defaults['limit'];
                }
+               if ( $options['limit'] > $max['limit'] ) {
+                       $options['limit'] = $max['limit'];
+               }
 
                if ( $options['offset'] < 0 ) {
                        $options['offset'] = $defaults['offset'];
                }
+               if ( $options['offset'] > $max['offset'] ) {
+                       $options['offset'] = $max['offset'];
+               }
 
                $nondefaults = array();
                foreach ( $options as $v => $t ) {