34 parent::__construct( $mainModule, $moduleName );
41 return 'apihelp-setpagelanguage-extended-description-disabled';
43 return parent::getExtendedDescription();
67 $titleObj = $pageObj->getTitle();
69 if ( !$pageObj->exists() ) {
78 if ( $params[
'tags'] ) {
79 $tagStatus = ChangeTags::canAddTagsAccompanyingChange( $params[
'tags'], $this->
getAuthority() );
80 if ( !$tagStatus->isOK() ) {
89 $params[
'reason'] ??
'',
90 $params[
'tags'] ?: [],
91 $this->dbProvider->getPrimaryDatabase()
94 if ( !$status->isOK() ) {
99 'title' => $titleObj->getPrefixedText(),
100 'oldlanguage' => $status->value->oldLanguage,
101 'newlanguage' => $status->value->newLanguage,
102 'logid' => $status->value->logId
122 ParamValidator::PARAM_TYPE =>
'integer'
125 ParamValidator::PARAM_TYPE => [
127 ...array_keys( $this->languageNameUtils->getLanguageNames(
128 LanguageNameUtils::AUTONYMS,
129 LanguageNameUtils::SUPPORTED
132 ParamValidator::PARAM_REQUIRED =>
true,
136 ParamValidator::PARAM_TYPE =>
'tags',
137 ParamValidator::PARAM_ISMULTI =>
true,
149 $title = Title::newMainPage()->getPrefixedText();
150 $mp = rawurlencode( $title );
153 "action=setpagelanguage&title={$mp}&lang=eu&token=123ABC"
154 =>
'apihelp-setpagelanguage-example-language',
155 'action=setpagelanguage&pageid=123&lang=default&token=123ABC'
156 =>
'apihelp-setpagelanguage-example-default',
162 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:SetPageLanguage';
167class_alias( ApiSetPageLanguage::class,
'ApiSetPageLanguage' );
This is the main API class, used for both external and internal processing.
API module that facilitates changing the language of a page.
getExtendedDescription()
Return the extended help text message.This is additional text to display at the top of the help secti...
needsToken()
Returns the token type this module requires in order to execute.Modules are strongly encouraged to us...
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
isWriteMode()
Indicates whether this module requires write access to the wiki.API modules must override this method...
__construct(ApiMain $mainModule, string $moduleName, private readonly IConnectionProvider $dbProvider, private readonly LanguageNameUtils $languageNameUtils,)
getExamplesMessages()
Returns usage examples for this module.Return value has query strings as keys, with values being eith...
execute()
Extracts the title and language from the request parameters and invokes the static SpecialPageLanguag...
mustBePosted()
Indicates whether this module must be called with a POST request.Implementations of this method must ...
getHelpUrls()
Return links to more detailed help pages about the module.1.25, returning boolean false is deprecated...
A class containing constants representing the names of configuration variables.
const PageLanguageUseDB
Name constant for the PageLanguageUseDB setting, for use with Config::get()
Special page for changing the content language of a page.
static changePageLanguage(IContextSource $context, Title $title, $newLanguage, $reason="", array $tags=[], ?IDatabase $dbw=null)