51 parent::__construct( $mainModule, $moduleName );
52 $this->dbProvider = $dbProvider;
53 $this->languageNameUtils = $languageNameUtils;
59 return 'apihelp-setpagelanguage-extended-description-disabled';
61 return parent::getExtendedDescription();
85 $titleObj = $pageObj->getTitle();
87 if ( !$pageObj->exists() ) {
98 if ( !$tagStatus->isOK() ) {
109 $this->dbProvider->getPrimaryDatabase()
112 if ( !$status->isOK() ) {
117 'title' => $titleObj->getPrefixedText(),
118 'oldlanguage' => $status->value->oldLanguage,
119 'newlanguage' => $status->value->newLanguage,
120 'logid' => $status->value->logId
137 ParamValidator::PARAM_TYPE =>
'integer'
140 ParamValidator::PARAM_TYPE => array_merge(
142 array_keys( $this->languageNameUtils->getLanguageNames(
143 LanguageNameUtils::AUTONYMS,
144 LanguageNameUtils::SUPPORTED
147 ParamValidator::PARAM_REQUIRED =>
true,
151 ParamValidator::PARAM_TYPE =>
'tags',
152 ParamValidator::PARAM_ISMULTI =>
true,
162 $title = Title::newMainPage()->getPrefixedText();
163 $mp = rawurlencode( $title );
166 "action=setpagelanguage&title={$mp}&lang=eu&token=123ABC"
167 =>
'apihelp-setpagelanguage-example-language',
168 'action=setpagelanguage&pageid=123&lang=default&token=123ABC'
169 =>
'apihelp-setpagelanguage-example-default',
174 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:SetPageLanguage';
179class_alias( ApiSetPageLanguage::class,
'ApiSetPageLanguage' );
array $params
The job parameters.
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.
needsToken()
Returns the token type this module requires in order to execute.
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.
getExamplesMessages()
Returns usage examples for this module.
execute()
Extracts the title and language from the request parameters and invokes the static SpecialPageLanguag...
__construct(ApiMain $mainModule, string $moduleName, IConnectionProvider $dbProvider, LanguageNameUtils $languageNameUtils)
mustBePosted()
Indicates whether this module must be called with a POST request.
getHelpUrls()
Return links to more detailed help pages about the module.
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)