Matthias Mullie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/213472
Change subject: Make ApiQueryWatchlist & ApiQueryRecentChanges accept more types
......................................................................
Make ApiQueryWatchlist & ApiQueryRecentChanges accept more types
It is currently locked down to just 4 types: new, edit, log, external.
There can be other rc_types you would like to query for.
MachineReadableRCFeedFormatter outputs 'type', which can be more than
just those 4 types (likely just the int value). For Flow things, for
example: 142 - we can not query for it.
This makes parseToRCType no longer throw an exception when the type is
different from edit|new|log|external, it will just return the integer
value in that case (like it does with edit|new|log|external). It's now
a proper counterpart to parseFromRCType.
The change to parseToRCType likely won't effect anything else:
ApiQueryWatchlist & ApiQueryRecentChanges were the only callers.
Change-Id: I3839f5ad33e7f9204914b812c3121ff4f0b274f5
---
M includes/api/ApiQueryRecentChanges.php
M includes/api/ApiQueryWatchlist.php
M includes/changes/RecentChange.php
3 files changed, 3 insertions(+), 14 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/72/213472/1
diff --git a/includes/api/ApiQueryRecentChanges.php
b/includes/api/ApiQueryRecentChanges.php
index 74bccc2..56c37cb 100644
--- a/includes/api/ApiQueryRecentChanges.php
+++ b/includes/api/ApiQueryRecentChanges.php
@@ -669,12 +669,7 @@
'type' => array(
ApiBase::PARAM_DFLT => 'edit|new|log',
ApiBase::PARAM_ISMULTI => true,
- ApiBase::PARAM_TYPE => array(
- 'edit',
- 'external',
- 'new',
- 'log'
- )
+ ApiBase::PARAM_TYPE => 'string',
),
'toponly' => false,
'continue' => array(
diff --git a/includes/api/ApiQueryWatchlist.php
b/includes/api/ApiQueryWatchlist.php
index 3eb57fd..5b0eabc 100644
--- a/includes/api/ApiQueryWatchlist.php
+++ b/includes/api/ApiQueryWatchlist.php
@@ -484,12 +484,7 @@
'type' => array(
ApiBase::PARAM_DFLT => 'edit|new|log',
ApiBase::PARAM_ISMULTI => true,
- ApiBase::PARAM_TYPE => array(
- 'edit',
- 'external',
- 'new',
- 'log',
- )
+ ApiBase::PARAM_TYPE => 'string',
),
'owner' => array(
ApiBase::PARAM_TYPE => 'user'
diff --git a/includes/changes/RecentChange.php
b/includes/changes/RecentChange.php
index 7ea6777..6af81e6 100644
--- a/includes/changes/RecentChange.php
+++ b/includes/changes/RecentChange.php
@@ -106,7 +106,6 @@
* Parsing text to RC_* constants
* @since 1.24
* @param string|array $type
- * @throws MWException
* @return int|array RC_TYPE
*/
public static function parseToRCType( $type ) {
@@ -129,7 +128,7 @@
case 'external':
return RC_EXTERNAL;
default:
- throw new MWException( "Unknown type '$type'" );
+ return (int) $type;
}
}
--
To view, visit https://gerrit.wikimedia.org/r/213472
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3839f5ad33e7f9204914b812c3121ff4f0b274f5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits