6 parent::__construct(
'ChangeContentModel',
'editcontentmodel' );
41 if ( !$this->
title ) {
63 if ( $this->oldRevision ) {
64 $oldContent = $this->oldRevision->getContent();
65 if ( !$oldContent->getContentHandler()->supportsDirectEditing() ) {
66 return $this->
msg(
'changecontentmodel-nodirectediting' )
80 'name' =>
'pagetitle',
82 'label-message' =>
'changecontentmodel-title-label',
83 'validation-callback' => [ $this,
'validateTitle' ],
90 'changecontentmodel-emptymodels-title',
91 'changecontentmodel-emptymodels-text',
92 $this->
title->getPrefixedText()
95 $fields[
'pagetitle'][
'readonly'] =
true;
101 'label-message' =>
'changecontentmodel-model-label'
106 'validation-callback' =>
function( $reason ) {
109 return $this->
msg(
'spamprotectionmatch', $match )->parse();
114 'label-message' =>
'changecontentmodel-reason-label',
125 foreach ( $models
as $model ) {
127 if ( !
$handler->supportsDirectEditing() ) {
147 if ( $data[
'pagetitle'] ===
'' ) {
165 $this->title->getUserPermissionsErrors(
'editcontentmodel',
$user ),
167 $this->title->getUserPermissionsErrors(
'edit',
$user ),
169 $titleWithNewContentModel->getUserPermissionsErrors(
'editcontentmodel',
$user ),
171 $titleWithNewContentModel->getUserPermissionsErrors(
'edit',
$user )
175 $wikitext =
$out->formatPermissionsErrorMessage( $errors );
181 if ( $this->oldRevision === null ) {
182 $this->oldRevision =
$page->getRevision() ?:
false;
184 $oldModel = $this->title->getContentModel();
185 if ( $this->oldRevision ) {
186 $oldContent = $this->oldRevision->getContent();
189 $oldContent->getNativeData(),
$this->title, $data[
'model']
193 $this->
msg(
'changecontentmodel-cannot-convert' )
195 $this->title->getPrefixedText(),
206 if (
$user->pingLimiter(
'editcontentmodel' ) ) {
212 if (
$user->isAllowed(
'bot' ) ) {
216 $log =
new ManualLogEntry(
'contentmodel', $this->oldRevision ?
'change' :
'new' );
217 $log->setPerformer(
$user );
218 $log->setTarget( $this->title );
219 $log->setComment( $data[
'reason'] );
220 $log->setParameters( [
221 '4::oldmodel' => $oldModel,
222 '5::newmodel' => $data[
'model']
227 $reason = $formatter->getPlainActionText();
228 if ( $data[
'reason'] !==
'' ) {
229 $reason .= $this->
msg(
'colon-separator' )->inContentLanguage()->text() . $data[
'reason'];
231 # Truncate for whole multibyte characters.
232 $reason = $wgContLang->truncate( $reason, 255 );
236 $derivativeContext->setTitle( $this->title );
237 $derivativeContext->setWikiPage(
$page );
240 [ $derivativeContext, $newContent,
$status, $reason,
245 $status->fatal(
'hookaborted' );
254 $this->oldRevision ? $this->oldRevision->getId() :
false,
261 $logid = $log->insert();
262 $log->publish( $logid );
269 $out->setPageTitle( $this->
msg(
'changecontentmodel-success-title' ) );
270 $out->addWikiMsg(
'changecontentmodel-success-text', $this->
title );
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
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 $out
the array() calling protocol came about after MediaWiki 1.4rc1.
getContext()
Gets the context this SpecialPage is executed in.
static getForModelID($modelId)
Returns the ContentHandler singleton for the given model ID.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException'returning false will NOT prevent logging $e
static newFatal($message)
Factory function for fatal errors.
static getContentModels()
An IContextSource implementation which will inherit context from another source but allow individual ...
it s the revision text itself In either if gzip is the revision text is gzipped $flags
msg()
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
getPrefixedText()
Get the prefixed title with spaces.
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
when a variable name is used in a it is silently declared as a new local masking the global
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target...
Special page which uses an HTMLForm to handle processing.
addHelpLink($to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
static matchSummarySpamRegex($text)
Check given input text against $wgSummarySpamRegex, and return the text of the first match...
static getLocalizedName($name, Language $lang=null)
Returns the localized name for a given content model.
getContentModel($flags=0)
Get the page's content model id, see the CONTENT_MODEL_XXX constants.
wfMergeErrorArrays()
Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g.
An error page which can definitely be safely rendered using the OutputPage.
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
static newExtraneousContext(Title $title, $request=[])
Create a new extraneous context.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
static makeContent($text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
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
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
static newFromTextThrow($text, $defaultNamespace=NS_MAIN)
Like Title::newFromText(), but throws MalformedTitleException when the title is invalid, rather than returning null.
prefixSearchSubpages($search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
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.
Variant of the Message class.
getUser()
Shortcut to get the User executing this instance.
string $par
The sub-page of the special page.
alterForm(HTMLForm $form)
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
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
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 $status
Revision bool null $oldRevision
A Revision object, false if no revision exists, null if not loaded yet.
getRequest()
Get the WebRequest being used for this instance.
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 modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves $handler
prefixSearchString($search, $limit, $offset)
Perform a regular substring search for prefixSearchSubpages.
Show an error when the user hits a rate limit.
getOptionsForTitle(Title $title=null)
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
setContentModel($model)
Set a proposed content model for the page for permissions checking.