* - string: Any non-empty string, not expected to be very long or contain newlines.
* <input type="text"> would be an appropriate HTML form field.
* - submodule: The name of a submodule of this module, see PARAM_SUBMODULE_MAP.
+ * - tags: A string naming an existing, explicitly-defined tag. Should usually be
+ * used with PARAM_ISMULTI.
* - text: Any non-empty string, expected to be very long or contain newlines.
* <textarea> would be an appropriate HTML form field.
* - timestamp: A timestamp in any format recognized by MWTimestamp, or the
break;
case 'upload': // nothing to do
break;
+ case 'tags':
+ // If change tagging was requested, check that the tags are valid.
+ if ( !is_array( $value ) && !$multi ) {
+ $value = array( $value );
+ }
+ $tagsStatus = ChangeTags::canAddTagsAccompanyingChange( $value );
+ if ( !$tagsStatus->isGood() ) {
+ $this->dieStatus( $tagsStatus );
+ }
+ break;
default:
ApiBase::dieDebug( __METHOD__, "Param $encParamName's type is unknown - $type" );
}
);
}
- if ( $this->getUser()->matchEditToken(
- $token,
- $salts[$tokenType],
- $this->getRequest()
- ) ) {
+ $tokenObj = ApiQueryTokens::getToken(
+ $this->getUser(), $this->getRequest()->getSession(), $salts[$tokenType]
+ );
+ if ( $tokenObj->match( $token ) ) {
return true;
}
/// @deprecated since 1.24
const PROP_NULLABLE = 1;
- /**
- * Formerly returned a string that identifies the version of the extending
- * class. Typically included the class name, the svn revision, timestamp,
- * and last author. Usually done with SVN's Id keyword
- *
- * @deprecated since 1.21, version string is no longer supported
- * @return string
- */
- public function getVersion() {
- wfDeprecated( __METHOD__, '1.21' );
- return '';
- }
-
/**
* Formerly used to fetch a list of possible properites in the result,
* somehow organized with respect to the prop parameter that causes them to
$type = null;
break;
+ case 'tags':
+ $tags = ChangeTags::listExplicitlyDefinedTags();
+ $count = count( $tags );
+ $info[] = $context->msg( 'api-help-param-list' )
+ ->params( $multi ? 2 : 1 )
+ ->params( $context->getLanguage()->commaList( $tags ) )
+ ->parse();
+ $hintPipeSeparated = false;
+ $type = null;
+ break;
+
case 'limit':
if ( isset( $settings[ApiBase::PARAM_MAX2] ) ) {
$info[] = $context->msg( 'api-help-param-limit2' )
) );
$link = wfAppendQuery( wfScript( 'api' ), $qs );
+ $sandbox = SpecialPage::getTitleFor( 'ApiSandbox' )->getLocalURL() . '#' . $qs;
$help['examples'] .= Html::rawElement( 'dt', null, $msg->parse() );
$help['examples'] .= Html::rawElement( 'dd', null,
- Html::element( 'a', array( 'href' => $link ), "api.php?$qs" )
+ Html::element( 'a', array( 'href' => $link ), "api.php?$qs" ) . ' ' .
+ Html::rawElement( 'a', array( 'href' => $sandbox ),
+ $context->msg( 'api-help-open-in-apisandbox' )->parse() )
);
}
$help['examples'] .= Html::closeElement( 'dl' );