57 parent::__construct( $mainModule, $moduleName );
58 $this->dbProvider = $dbProvider;
59 $this->languageNameUtils = $languageNameUtils;
65 return 'apihelp-setpagelanguage-extended-description-disabled';
67 return parent::getExtendedDescription();
91 $titleObj = $pageObj->getTitle();
93 if ( !$pageObj->exists() ) {
104 if ( !$tagStatus->isOK() ) {
115 $this->dbProvider->getPrimaryDatabase()
118 if ( !$status->isOK() ) {
123 'title' => $titleObj->getPrefixedText(),
124 'oldlanguage' => $status->value->oldLanguage,
125 'newlanguage' => $status->value->newLanguage,
126 'logid' => $status->value->logId
143 ParamValidator::PARAM_TYPE =>
'integer'
146 ParamValidator::PARAM_TYPE => array_merge(
148 array_keys( $this->languageNameUtils->getLanguageNames(
149 LanguageNameUtils::AUTONYMS,
150 LanguageNameUtils::SUPPORTED
153 ParamValidator::PARAM_REQUIRED =>
true,
157 ParamValidator::PARAM_TYPE =>
'tags',
158 ParamValidator::PARAM_ISMULTI =>
true,
168 $title = Title::newMainPage()->getPrefixedText();
169 $mp = rawurlencode( $title );
172 "action=setpagelanguage&title={$mp}&lang=eu&token=123ABC"
173 =>
'apihelp-setpagelanguage-example-language',
174 'action=setpagelanguage&pageid=123&lang=default&token=123ABC'
175 =>
'apihelp-setpagelanguage-example-default',
180 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:SetPageLanguage';
185class_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, $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)