Poke has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/96070


Change subject: Integrate feed-specific setup into general setup
......................................................................

Integrate feed-specific setup into general setup

The special page setup was previously handled separately for feed output
to restrict the request arguments to a small subset of possible filter
options. This behavior was removed in 52b59f0685.

This makes the main difference between the normal and the feed setup that
custom filter options were not loaded for feed output. Support for custom
filter options was introduced with fcbdd58326 but did not touch the feed
setup, preventing filters from being initialized when requesting a feed
(see bug 57201).

After adding support for custom filters to the feed setup, the only
remaining difference is a different default limit, and the support for
subpage syntax for non-feed output.

This commit merges the feed setup with the standard setup.

Furthermore, in `SpecialRecentchangeslinked`, the extra argument parsing
was made also redundant with 52b59f0685.

Bug: 57201
Change-Id: Ia8ba28efb96da9df5d7252278d46ff88a143368c
---
M includes/specials/SpecialRecentchanges.php
M includes/specials/SpecialRecentchangeslinked.php
M tests/phpunit/includes/specials/SpecialRecentchangesTest.php
3 files changed, 8 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/70/96070/1

diff --git a/includes/specials/SpecialRecentchanges.php 
b/includes/specials/SpecialRecentchanges.php
index 23203ea..1d96523 100644
--- a/includes/specials/SpecialRecentchanges.php
+++ b/includes/specials/SpecialRecentchanges.php
@@ -68,11 +68,13 @@
        /**
         * Create a FormOptions object with options as specified by the user
         *
+        * @param bool $isFeed
         * @param array $parameters
-        *
         * @return FormOptions
         */
-       public function setup( $parameters ) {
+       public function setup( $isFeed, $parameters ) {
+               global $wgFeedLimit;
+
                $opts = $this->getDefaultOptions();
 
                foreach ( $this->getCustomFilters() as $key => $params ) {
@@ -82,11 +84,11 @@
                $opts->fetchValuesFromRequest( $this->getRequest() );
 
                // Give precedence to subpage syntax
-               if ( $parameters !== null ) {
+               if ( !$isFeed && $parameters !== null ) {
                        $this->parseParameters( $parameters, $opts );
                }
 
-               $opts->validateIntBounds( 'limit', 0, 5000 );
+               $opts->validateIntBounds( 'limit', 0, $isFeed ? $wgFeedLimit : 
5000 );
 
                return $opts;
        }
@@ -106,20 +108,6 @@
        }
 
        /**
-        * Create a FormOptions object specific for feed requests and return it
-        *
-        * @return FormOptions
-        */
-       public function feedSetup() {
-               global $wgFeedLimit;
-               $opts = $this->getDefaultOptions();
-               $opts->fetchValuesFromRequest( $this->getRequest() );
-               $opts->validateIntBounds( 'limit', 0, $wgFeedLimit );
-
-               return $opts;
-       }
-
-       /**
         * Get the current FormOptions for this request
         */
        public function getOptions() {
@@ -129,7 +117,7 @@
                        } else {
                                $isFeed = (bool)$this->getRequest()->getVal( 
'feed' );
                        }
-                       $this->rcOptions = $isFeed ? $this->feedSetup() : 
$this->setup( $this->rcSubpage );
+                       $this->rcOptions = $this->setup( $isFeed, 
$this->rcSubpage );
                }
 
                return $this->rcOptions;
diff --git a/includes/specials/SpecialRecentchangeslinked.php 
b/includes/specials/SpecialRecentchangeslinked.php
index f37ea20..f5111f3 100644
--- a/includes/specials/SpecialRecentchangeslinked.php
+++ b/includes/specials/SpecialRecentchangeslinked.php
@@ -44,12 +44,6 @@
                $opts['target'] = $par;
        }
 
-       public function feedSetup() {
-               $opts = parent::feedSetup();
-               $opts['target'] = $this->getRequest()->getVal( 'target' );
-               return $opts;
-       }
-
        public function getFeedObject( $feedFormat ) {
                $feed = new ChangesFeed( $feedFormat, false );
                $feedObj = $feed->getFeedObject(
diff --git a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php 
b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
index b1ba152..e4747de 100644
--- a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
+++ b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php
@@ -24,7 +24,7 @@
                # setup the rc object
                $this->rc = new SpecialRecentChanges();
                $this->rc->setContext( $context );
-               $formOptions = $this->rc->setup( null );
+               $formOptions = $this->rc->setup( false, null );
 
                # Filter out rc_timestamp conditions which depends on the test 
runtime
                # This condition is not needed as of march 2, 2011 -- hashar

-- 
To view, visit https://gerrit.wikimedia.org/r/96070
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8ba28efb96da9df5d7252278d46ff88a143368c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Poke <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to