From d2fb76915aab972316f0e3015c9920074c71293b Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 13 Mar 2008 18:45:33 +0000 Subject: [PATCH] * (bug 13298) Tighter limits on Special:Newpages limits when embedding --- RELEASE-NOTES | 1 + includes/SpecialNewpages.php | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c2888ad7a3..375b95006a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index 1c3bee84c4..16b5642638 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -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 ) { -- 2.20.1