2006-10-16 00:08:03 +00:00
|
|
|
<?php
|
2010-02-23 12:30:23 +00:00
|
|
|
/**
|
2010-12-22 20:52:06 +00:00
|
|
|
*
|
2006-10-16 00:08:03 +00:00
|
|
|
*
|
2010-08-07 19:59:42 +00:00
|
|
|
* Created on Oct 13, 2006
|
|
|
|
|
*
|
2012-07-15 20:13:02 +00:00
|
|
|
* Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
|
2006-10-16 00:08:03 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
2010-06-21 13:13:32 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-10-16 00:08:03 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
2010-08-07 19:59:42 +00:00
|
|
|
*
|
|
|
|
|
* @file
|
2006-10-16 00:08:03 +00:00
|
|
|
*/
|
|
|
|
|
|
2007-04-20 08:55:14 +00:00
|
|
|
/**
|
2007-05-20 10:08:40 +00:00
|
|
|
* This action allows users to get their watchlist items in RSS/Atom formats.
|
|
|
|
|
* When executed, it performs a nested call to the API to get the needed data,
|
|
|
|
|
* and formats it in a proper format.
|
2008-04-14 07:45:50 +00:00
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup API
|
2007-04-20 08:55:14 +00:00
|
|
|
*/
|
2006-10-16 00:08:03 +00:00
|
|
|
class ApiFeedWatchlist extends ApiBase {
|
|
|
|
|
|
2013-03-24 00:32:58 +00:00
|
|
|
private $watchlistModule = null;
|
2013-04-09 18:16:08 +00:00
|
|
|
private $linkToSections = false;
|
2013-03-24 00:32:58 +00:00
|
|
|
|
2007-05-20 10:08:40 +00:00
|
|
|
/**
|
|
|
|
|
* This module uses a custom feed wrapper printer.
|
2011-09-21 16:36:43 +00:00
|
|
|
*
|
|
|
|
|
* @return ApiFormatFeedWrapper
|
2007-05-20 10:08:40 +00:00
|
|
|
*/
|
2006-10-16 00:08:03 +00:00
|
|
|
public function getCustomPrinter() {
|
2010-01-11 15:55:52 +00:00
|
|
|
return new ApiFormatFeedWrapper( $this->getMain() );
|
2006-10-16 00:08:03 +00:00
|
|
|
}
|
|
|
|
|
|
2007-05-21 04:34:48 +00:00
|
|
|
/**
|
|
|
|
|
* Make a nested call to the API to request watchlist items in the last $hours.
|
|
|
|
|
* Wrap the result as an RSS/Atom feed.
|
|
|
|
|
*/
|
2006-10-16 00:08:03 +00:00
|
|
|
public function execute() {
|
2014-01-24 02:51:11 +00:00
|
|
|
$config = $this->getConfig();
|
|
|
|
|
$feedClasses = $config->get( 'FeedClasses' );
|
2017-01-18 00:48:59 +00:00
|
|
|
$params = [];
|
2007-05-19 05:15:24 +00:00
|
|
|
try {
|
2007-05-20 10:08:40 +00:00
|
|
|
$params = $this->extractRequestParams();
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2014-01-24 02:51:11 +00:00
|
|
|
if ( !$config->get( 'Feed' ) ) {
|
2016-10-19 16:54:25 +00:00
|
|
|
$this->dieWithError( 'feed-unavailable' );
|
2011-06-06 14:06:37 +00:00
|
|
|
}
|
|
|
|
|
|
2014-01-24 02:51:11 +00:00
|
|
|
if ( !isset( $feedClasses[$params['feedformat']] ) ) {
|
2016-10-19 16:54:25 +00:00
|
|
|
$this->dieWithError( 'feed-invalid' );
|
2011-06-06 14:06:37 +00:00
|
|
|
}
|
|
|
|
|
|
2007-05-20 10:08:40 +00:00
|
|
|
// limit to the number of hours going from now back
|
2010-01-11 15:55:52 +00:00
|
|
|
$endTime = wfTimestamp( TS_MW, time() - intval( $params['hours'] * 60 * 60 ) );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2007-09-26 03:24:01 +00:00
|
|
|
// Prepare parameters for nested request
|
2016-02-17 09:09:32 +00:00
|
|
|
$fauxReqArr = [
|
2007-05-20 10:08:40 +00:00
|
|
|
'action' => 'query',
|
|
|
|
|
'meta' => 'siteinfo',
|
|
|
|
|
'siprop' => 'general',
|
|
|
|
|
'list' => 'watchlist',
|
2014-05-10 01:54:54 +00:00
|
|
|
'wlprop' => 'title|user|comment|timestamp|ids',
|
2010-02-23 12:30:23 +00:00
|
|
|
'wldir' => 'older', // reverse order - from newest to oldest
|
2010-10-16 16:53:10 +00:00
|
|
|
'wlend' => $endTime, // stop at this time
|
2014-01-24 02:51:11 +00:00
|
|
|
'wllimit' => min( 50, $this->getConfig()->get( 'FeedLimit' ) )
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2007-09-26 03:24:01 +00:00
|
|
|
|
2013-03-10 21:08:22 +00:00
|
|
|
if ( $params['wlowner'] !== null ) {
|
2009-07-26 17:04:22 +00:00
|
|
|
$fauxReqArr['wlowner'] = $params['wlowner'];
|
2010-02-19 01:25:57 +00:00
|
|
|
}
|
2013-03-10 21:08:22 +00:00
|
|
|
if ( $params['wltoken'] !== null ) {
|
2009-07-24 01:22:06 +00:00
|
|
|
$fauxReqArr['wltoken'] = $params['wltoken'];
|
2010-02-19 01:25:57 +00:00
|
|
|
}
|
2013-03-10 21:08:22 +00:00
|
|
|
if ( $params['wlexcludeuser'] !== null ) {
|
|
|
|
|
$fauxReqArr['wlexcludeuser'] = $params['wlexcludeuser'];
|
|
|
|
|
}
|
2013-03-24 00:32:58 +00:00
|
|
|
if ( $params['wlshow'] !== null ) {
|
|
|
|
|
$fauxReqArr['wlshow'] = $params['wlshow'];
|
|
|
|
|
}
|
2013-04-30 16:01:00 +00:00
|
|
|
if ( $params['wltype'] !== null ) {
|
|
|
|
|
$fauxReqArr['wltype'] = $params['wltype'];
|
|
|
|
|
}
|
2009-07-24 01:22:06 +00:00
|
|
|
|
2013-04-09 18:16:08 +00:00
|
|
|
// Support linking directly to sections when possible
|
|
|
|
|
// (possible only if section name is present in comment)
|
|
|
|
|
if ( $params['linktosections'] ) {
|
|
|
|
|
$this->linkToSections = true;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-26 03:24:01 +00:00
|
|
|
// Check for 'allrev' parameter, and if found, show all revisions to each page on wl.
|
2011-10-13 16:40:22 +00:00
|
|
|
if ( $params['allrev'] ) {
|
2010-02-19 01:25:57 +00:00
|
|
|
$fauxReqArr['wlallrev'] = '';
|
|
|
|
|
}
|
2007-09-26 03:24:01 +00:00
|
|
|
|
|
|
|
|
// Create the request
|
2010-02-23 12:30:23 +00:00
|
|
|
$fauxReq = new FauxRequest( $fauxReqArr );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2007-05-20 10:08:40 +00:00
|
|
|
// Execute
|
2010-01-11 15:55:52 +00:00
|
|
|
$module = new ApiMain( $fauxReq );
|
2007-05-19 05:15:24 +00:00
|
|
|
$module->execute();
|
2006-10-16 00:08:03 +00:00
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$data = $module->getResult()->getResultData( [ 'query', 'watchlist' ] );
|
|
|
|
|
$feedItems = [];
|
API: Overhaul ApiResult, make format=xml not throw, and add json formatversion
ApiResult was a mess: some methods could only be used with an array
reference instead of manipulating the stored data, methods that had both
array-ref and internal-data versions had names that didn't at all
correspond, some methods that worked on an array reference were
annoyingly non-static, and then the whole mess with setIndexedTagName.
ApiFormatXml is also entirely annoying to deal with, as it liked to
throw exceptions if certain metadata wasn't provided that no other
formatter required. Its legacy also means we have this silly convention
of using empty-string rather than boolean true, annoying restrictions on
keys (leading to things that should be hashes being arrays of key-value
object instead), '*' used as a key all over the place, and so on.
So, changes here:
* ApiResult is no longer an ApiBase or a ContextSource.
* Wherever sensible, ApiResult provides a static method working on an
arrayref and a non-static method working on internal data.
* Metadata is now always added to ApiResult's internal data structure.
Formatters are responsible for stripping it if necessary. "raw mode"
is deprecated.
* New metadata to replace the '*' key, solve the array() => '[]' vs '{}'
question, and so on.
* New class for formatting warnings and errors using i18n messages, and
support for multiple errors and a more machine-readable format for
warnings. For the moment, though, the actual output will not be changing
yet (see T47843 for future plans).
* New formatversion parameter for format=json and format=php, to select
between BC mode and the modern output.
* In BC mode, booleans will be converted to empty-string presence style;
modules currently returning booleans will need to use
ApiResult::META_BC_BOOLS to preserve their current output.
Actual changes to the API modules' output (e.g. actually returning
booleans for the new formatversion) beyond the use of
ApiResult::setContentValue() are left for a future change.
Bug: T76728
Bug: T57371
Bug: T33629
Change-Id: I7b37295e8862b188d1f3b0cd07f66ac34629678f
2014-12-03 22:14:22 +00:00
|
|
|
foreach ( (array)$data as $key => $info ) {
|
|
|
|
|
if ( ApiResult::isMetadataKey( $key ) ) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2015-03-03 15:10:20 +00:00
|
|
|
$feedItem = $this->createFeedItem( $info );
|
|
|
|
|
if ( $feedItem ) {
|
|
|
|
|
$feedItems[] = $feedItem;
|
|
|
|
|
}
|
2007-05-19 05:15:24 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2012-07-24 01:04:15 +00:00
|
|
|
$msg = wfMessage( 'watchlist' )->inContentLanguage()->text();
|
2011-06-06 15:01:27 +00:00
|
|
|
|
2015-06-26 05:32:28 +00:00
|
|
|
$feedTitle = $this->getConfig()->get( 'Sitename' ) . ' - ' . $msg .
|
|
|
|
|
' [' . $this->getConfig()->get( 'LanguageCode' ) . ']';
|
2010-02-23 12:30:23 +00:00
|
|
|
$feedUrl = SpecialPage::getTitleFor( 'Watchlist' )->getFullURL();
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2014-01-24 02:51:11 +00:00
|
|
|
$feed = new $feedClasses[$params['feedformat']] (
|
2013-11-16 19:09:17 +00:00
|
|
|
$feedTitle,
|
|
|
|
|
htmlspecialchars( $msg ),
|
|
|
|
|
$feedUrl
|
|
|
|
|
);
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2010-02-23 12:30:23 +00:00
|
|
|
ApiFormatFeedWrapper::setResult( $this->getResult(), $feed, $feedItems );
|
2010-01-11 15:55:52 +00:00
|
|
|
} catch ( Exception $e ) {
|
2007-05-19 05:15:24 +00:00
|
|
|
// Error results should not be cached
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->getMain()->setCacheMaxAge( 0 );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2013-11-16 19:09:17 +00:00
|
|
|
// @todo FIXME: Localise brackets
|
2014-01-24 02:51:11 +00:00
|
|
|
$feedTitle = $this->getConfig()->get( 'Sitename' ) . ' - Error - ' .
|
2013-11-16 19:09:17 +00:00
|
|
|
wfMessage( 'watchlist' )->inContentLanguage()->text() .
|
2014-01-24 02:51:11 +00:00
|
|
|
' [' . $this->getConfig()->get( 'LanguageCode' ) . ']';
|
2010-02-23 12:30:23 +00:00
|
|
|
$feedUrl = SpecialPage::getTitleFor( 'Watchlist' )->getFullURL();
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
$feedFormat = isset( $params['feedformat'] ) ? $params['feedformat'] : 'rss';
|
2012-07-24 01:04:15 +00:00
|
|
|
$msg = wfMessage( 'watchlist' )->inContentLanguage()->escaped();
|
2014-01-24 02:51:11 +00:00
|
|
|
$feed = new $feedClasses[$feedFormat] ( $feedTitle, $msg, $feedUrl );
|
2006-10-18 23:49:09 +00:00
|
|
|
|
2016-10-19 16:54:25 +00:00
|
|
|
if ( $e instanceof ApiUsageException ) {
|
|
|
|
|
foreach ( $e->getStatusValue()->getErrors() as $error ) {
|
|
|
|
|
$msg = ApiMessage::create( $error )
|
|
|
|
|
->inLanguage( $this->getLanguage() );
|
|
|
|
|
$errorTitle = $this->msg( 'api-feed-error-title', $msg->getApiCode() );
|
|
|
|
|
$errorText = $msg->text();
|
|
|
|
|
$feedItems[] = new FeedItem( $errorTitle, $errorText, '', '', '' );
|
|
|
|
|
}
|
2007-05-19 05:15:24 +00:00
|
|
|
} else {
|
2016-10-19 16:54:25 +00:00
|
|
|
if ( $e instanceof UsageException ) {
|
|
|
|
|
$errorCode = $e->getCodeString();
|
|
|
|
|
} else {
|
|
|
|
|
// Something is seriously wrong
|
|
|
|
|
$errorCode = 'internal_api_error';
|
|
|
|
|
}
|
|
|
|
|
$errorTitle = $this->msg( 'api-feed-error-title', $msg->getApiCode() );
|
|
|
|
|
$errorText = $e->getMessage();
|
|
|
|
|
$feedItems[] = new FeedItem( $errorTitle, $errorText, '', '', '' );
|
2007-05-19 05:15:24 +00:00
|
|
|
}
|
|
|
|
|
|
2010-02-23 12:30:23 +00:00
|
|
|
ApiFormatFeedWrapper::setResult( $this->getResult(), $feed, $feedItems );
|
2007-05-19 05:15:24 +00:00
|
|
|
}
|
2006-10-16 00:08:03 +00:00
|
|
|
}
|
|
|
|
|
|
2011-10-27 00:46:17 +00:00
|
|
|
/**
|
2014-04-15 18:12:09 +00:00
|
|
|
* @param array $info
|
2011-10-27 00:46:17 +00:00
|
|
|
* @return FeedItem
|
|
|
|
|
*/
|
2010-01-11 15:55:52 +00:00
|
|
|
private function createFeedItem( $info ) {
|
2015-07-10 14:04:10 +00:00
|
|
|
if ( !isset( $info['title'] ) ) {
|
|
|
|
|
// Probably a revdeled log entry, skip it.
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-18 23:49:09 +00:00
|
|
|
$titleStr = $info['title'];
|
2010-02-23 12:30:23 +00:00
|
|
|
$title = Title::newFromText( $titleStr );
|
2016-02-17 09:09:32 +00:00
|
|
|
$curidParam = [];
|
2015-03-03 15:10:20 +00:00
|
|
|
if ( !$title || $title->isExternal() ) {
|
|
|
|
|
// Probably a formerly-valid title that's now conflicting with an
|
|
|
|
|
// interwiki prefix or the like.
|
|
|
|
|
if ( isset( $info['pageid'] ) ) {
|
2015-11-07 21:10:23 +00:00
|
|
|
$title = Title::newFromID( $info['pageid'] );
|
2016-02-17 09:09:32 +00:00
|
|
|
$curidParam = [ 'curid' => $info['pageid'] ];
|
2015-03-03 15:10:20 +00:00
|
|
|
}
|
|
|
|
|
if ( !$title || $title->isExternal() ) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-05-10 01:54:54 +00:00
|
|
|
if ( isset( $info['revid'] ) ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
$titleUrl = $title->getFullURL( [ 'diff' => $info['revid'] ] );
|
2010-11-27 19:24:48 +00:00
|
|
|
} else {
|
2015-03-03 15:10:20 +00:00
|
|
|
$titleUrl = $title->getFullURL( $curidParam );
|
2010-11-27 19:24:48 +00:00
|
|
|
}
|
2006-11-29 05:45:03 +00:00
|
|
|
$comment = isset( $info['comment'] ) ? $info['comment'] : null;
|
2013-04-09 18:16:08 +00:00
|
|
|
|
|
|
|
|
// Create an anchor to section.
|
|
|
|
|
// The anchor won't work for sections that have dupes on page
|
|
|
|
|
// as there's no way to strip that info from ApiWatchlist (apparently?).
|
|
|
|
|
// RegExp in the line below is equal to Linker::formatAutocomments().
|
2013-11-16 19:09:17 +00:00
|
|
|
if ( $this->linkToSections && $comment !== null &&
|
|
|
|
|
preg_match( '!(.*)/\*\s*(.*?)\s*\*/(.*)!', $comment, $matches )
|
|
|
|
|
) {
|
2013-04-09 18:16:08 +00:00
|
|
|
global $wgParser;
|
2013-11-16 19:09:17 +00:00
|
|
|
|
2013-04-09 18:16:08 +00:00
|
|
|
$sectionTitle = $wgParser->stripSectionName( $matches[2] );
|
|
|
|
|
$sectionTitle = Sanitizer::normalizeSectionNameWhitespace( $sectionTitle );
|
|
|
|
|
$titleUrl .= Title::newFromText( '#' . $sectionTitle )->getFragmentForURL();
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-18 23:49:09 +00:00
|
|
|
$timestamp = $info['timestamp'];
|
|
|
|
|
|
2015-07-10 14:04:10 +00:00
|
|
|
if ( isset( $info['user'] ) ) {
|
|
|
|
|
$user = $info['user'];
|
|
|
|
|
$completeText = "$comment ($user)";
|
|
|
|
|
} else {
|
|
|
|
|
$user = '';
|
|
|
|
|
$completeText = (string)$comment;
|
|
|
|
|
}
|
2006-10-18 23:49:09 +00:00
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
return new FeedItem( $titleStr, $completeText, $titleUrl, $timestamp, $user );
|
2006-10-18 23:49:09 +00:00
|
|
|
}
|
|
|
|
|
|
2013-03-24 00:32:58 +00:00
|
|
|
private function getWatchlistModule() {
|
|
|
|
|
if ( $this->watchlistModule === null ) {
|
|
|
|
|
$this->watchlistModule = $this->getMain()->getModuleManager()->getModule( 'query' )
|
|
|
|
|
->getModuleManager()->getModule( 'watchlist' );
|
|
|
|
|
}
|
2013-11-14 12:40:22 +00:00
|
|
|
|
2013-03-24 00:32:58 +00:00
|
|
|
return $this->watchlistModule;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getAllowedParams( $flags = 0 ) {
|
2014-01-24 02:51:11 +00:00
|
|
|
$feedFormatNames = array_keys( $this->getConfig()->get( 'FeedClasses' ) );
|
2016-02-17 09:09:32 +00:00
|
|
|
$ret = [
|
|
|
|
|
'feedformat' => [
|
2010-02-23 12:30:23 +00:00
|
|
|
ApiBase::PARAM_DFLT => 'rss',
|
|
|
|
|
ApiBase::PARAM_TYPE => $feedFormatNames
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
'hours' => [
|
2010-02-23 12:30:23 +00:00
|
|
|
ApiBase::PARAM_DFLT => 24,
|
|
|
|
|
ApiBase::PARAM_TYPE => 'integer',
|
|
|
|
|
ApiBase::PARAM_MIN => 1,
|
|
|
|
|
ApiBase::PARAM_MAX => 72,
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
2013-04-09 18:16:08 +00:00
|
|
|
'linktosections' => false,
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2014-09-18 17:38:23 +00:00
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$copyParams = [
|
2014-09-18 17:38:23 +00:00
|
|
|
'allrev' => 'allrev',
|
|
|
|
|
'owner' => 'wlowner',
|
|
|
|
|
'token' => 'wltoken',
|
|
|
|
|
'show' => 'wlshow',
|
|
|
|
|
'type' => 'wltype',
|
|
|
|
|
'excludeuser' => 'wlexcludeuser',
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2013-03-24 00:32:58 +00:00
|
|
|
if ( $flags ) {
|
|
|
|
|
$wlparams = $this->getWatchlistModule()->getAllowedParams( $flags );
|
2014-09-18 17:38:23 +00:00
|
|
|
foreach ( $copyParams as $from => $to ) {
|
|
|
|
|
$p = $wlparams[$from];
|
|
|
|
|
if ( !is_array( $p ) ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
$p = [ ApiBase::PARAM_DFLT => $p ];
|
2014-09-18 17:38:23 +00:00
|
|
|
}
|
|
|
|
|
if ( !isset( $p[ApiBase::PARAM_HELP_MSG] ) ) {
|
|
|
|
|
$p[ApiBase::PARAM_HELP_MSG] = "apihelp-query+watchlist-param-$from";
|
|
|
|
|
}
|
2015-12-02 14:09:08 +00:00
|
|
|
if ( isset( $p[ApiBase::PARAM_TYPE] ) && is_array( $p[ApiBase::PARAM_TYPE] ) &&
|
|
|
|
|
isset( $p[ApiBase::PARAM_HELP_MSG_PER_VALUE] )
|
|
|
|
|
) {
|
2015-11-16 15:26:39 +00:00
|
|
|
foreach ( $p[ApiBase::PARAM_TYPE] as $v ) {
|
|
|
|
|
if ( !isset( $p[ApiBase::PARAM_HELP_MSG_PER_VALUE][$v] ) ) {
|
|
|
|
|
$p[ApiBase::PARAM_HELP_MSG_PER_VALUE][$v] = "apihelp-query+watchlist-paramvalue-$from-$v";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-09-18 17:38:23 +00:00
|
|
|
$ret[$to] = $p;
|
|
|
|
|
}
|
2013-03-24 00:32:58 +00:00
|
|
|
} else {
|
2014-09-18 17:38:23 +00:00
|
|
|
foreach ( $copyParams as $from => $to ) {
|
|
|
|
|
$ret[$to] = null;
|
|
|
|
|
}
|
2013-03-24 00:32:58 +00:00
|
|
|
}
|
2013-11-14 12:40:22 +00:00
|
|
|
|
2013-03-24 00:32:58 +00:00
|
|
|
return $ret;
|
2006-10-16 00:08:03 +00:00
|
|
|
}
|
|
|
|
|
|
2014-10-28 17:17:02 +00:00
|
|
|
protected function getExamplesMessages() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
2014-09-18 17:38:23 +00:00
|
|
|
'action=feedwatchlist'
|
|
|
|
|
=> 'apihelp-feedwatchlist-example-default',
|
|
|
|
|
'action=feedwatchlist&allrev=&hours=6'
|
|
|
|
|
=> 'apihelp-feedwatchlist-example-all6hrs',
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2006-10-16 00:08:03 +00:00
|
|
|
}
|
|
|
|
|
|
2011-07-17 16:38:24 +00:00
|
|
|
public function getHelpUrls() {
|
2017-04-04 22:52:57 +00:00
|
|
|
return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Watchlist_feed';
|
2011-07-17 16:38:24 +00:00
|
|
|
}
|
2006-10-16 00:08:03 +00:00
|
|
|
}
|