38 parent::__construct(
'PageLanguage',
'pagelang' );
46 $this->
getOutput()->addModules(
'mediawiki.special.pageLanguage' );
56 'label-message' =>
'pagelang-name',
57 'default' => $defaultName,
58 'autofocus' => $defaultName === null,
64 (
string)$this->
msg(
'pagelang-use-default' )->escaped() => 1,
65 (
string)$this->
msg(
'pagelang-select-lang' )->escaped() => 2,
67 $page[
'selectoptions'] = [
68 'id' =>
'mw-pl-options',
70 'options' => $selectoptions,
84 'id' =>
'mw-pl-languageselector',
85 'cssclass' =>
'mw-languageselector',
88 'label-message' =>
'pagelang-language',
89 'default' => $this->
getConfig()->get(
'LanguageCode' ),
125 $defLang = $this->
getConfig()->get(
'LanguageCode' );
127 $pageId =
$title->getArticleID();
136 $langOld = $dbw->selectField(
139 [
'page_id' => $pageId ],
144 $this->goToUrl =
$title->getFullURL();
147 if ( $data[
'selectoptions'] == 1 ) {
150 $langNew = $data[
'language'];
154 if ( $langNew === $langOld ) {
159 $logOld = $langOld ? $langOld : $defLang .
'[def]';
160 $logNew = $langNew ? $langNew : $defLang .
'[def]';
166 [
'page_lang' => $langNew ],
168 'page_id' => $pageId,
169 'page_lang' => $langOld
174 if ( !$dbw->affectedRows() ) {
180 '4::oldlanguage' => $logOld,
181 '5::newlanguage' => $logNew
184 $entry->setPerformer( $this->
getUser() );
185 $entry->setTarget(
$title );
186 $entry->setParameters( $logParams );
188 $logid = $entry->insert();
189 $entry->publish( $logid );
192 $title->invalidateCache();
199 $this->
getOutput()->redirect( $this->goToUrl );
203 $moveLogPage =
new LogPage(
'pagelang' );
204 $out1 =
Xml::element(
'h2', null, $moveLogPage->getName()->text() );
207 return $out1 . $out2;
alterForm(HTMLForm $form)
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
the array() calling protocol came about after MediaWiki 1.4rc1.
static element($element, $attribs=null, $contents= '', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
msg()
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Special page which uses an HTMLForm to handle processing.
Special page for changing the content language of a page.
static fetchLanguageNames($inLanguage=null, $include= 'mw')
Get an array of language names, indexed by code.
static showLogExtract(&$out, $types=[], $page= '', $user= '', $param=[])
Show log extract.
Class to simplify the use of log pages.
prefixSearchSubpages($search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
switch($options['output']) $languages
namespace and then decline to actually register it file or subcat img or subcat $title
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Class for creating log entries manually, to inject them into the database.
getUser()
Shortcut to get the User executing this instance.
string $par
The sub-page of the special page.
getConfig()
Shortcut to get main config object.
getLanguage()
Shortcut to get user's language.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive $limit
string $goToUrl
URL to go to if language change successful.
prefixSearchString($search, $limit, $offset)
Perform a regular substring search for prefixSearchSubpages.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
Allows to change the fields on the form that will be generated $name