From 94956a33e836812bfb9f24edb75be895c1bb9775 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Sat, 25 Apr 2015 07:20:43 -0400 Subject: [PATCH] API: Fix parameter interpretation in ApiFeedRecentChanges ApiFeedRecentChanges uses special page logic (eew) to do its thing. Lacking the time at the moment to refactor the business logic, let's at least pass the parsed parameters in via a FauxRequest instead of allowing the special page logic to do its own interpretation of the raw parameters. This makes it so all recognized timestamp formats are supported (instead of only TS_MW) and fixes the interpretation of booleans to match API standards. Bug: T97213 Change-Id: Ia254e36b5df2e552e283fb57ce859d6478908bd9 --- includes/api/ApiFeedRecentChanges.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiFeedRecentChanges.php b/includes/api/ApiFeedRecentChanges.php index d452bbd630..d24112c7c8 100644 --- a/includes/api/ApiFeedRecentChanges.php +++ b/includes/api/ApiFeedRecentChanges.php @@ -66,9 +66,17 @@ class ApiFeedRecentChanges extends ApiBase { $formatter = $this->getFeedObject( $feedFormat, $specialClass ); - // Everything is passed implicitly via $wgRequest… :( - // The row-getting functionality should maybe be factored out of ChangesListSpecialPage too… + // Parameters are passed via the request in the context… :( + $context = new DerivativeContext( $this ); + $context->setRequest( new DerivativeRequest( + $this->getRequest(), + $this->params, + $this->getRequest()->wasPosted() + ) ); + + // The row-getting functionality should be factored out of ChangesListSpecialPage too… $rc = new $specialClass(); + $rc->setContext( $context ); $rows = $rc->getRows(); $feedItems = $rows ? ChangesFeed::buildItems( $rows ) : array(); -- 2.20.1