Go to the documentation of this file.
6 parent::__construct(
'ChangeContentModel',
'editcontentmodel' );
39 $contentModelLogPage =
new LogPage(
'contentmodel' );
40 $text =
Xml::element(
'h2',
null, $contentModelLogPage->getName()->text() );
53 if ( !$this->
title ) {
75 if ( $this->oldRevision ) {
76 $oldContent = $this->oldRevision->getContent();
77 if ( !$oldContent->getContentHandler()->supportsDirectEditing() ) {
78 return $this->
msg(
'changecontentmodel-nodirectediting' )
92 'name' =>
'pagetitle',
94 'label-message' =>
'changecontentmodel-title-label',
95 'validation-callback' => [ $this,
'validateTitle' ],
102 'changecontentmodel-emptymodels-title',
103 'changecontentmodel-emptymodels-text',
104 $this->
title->getPrefixedText()
107 $fields[
'pagetitle'][
'readonly'] =
true;
113 'label-message' =>
'changecontentmodel-model-label'
118 'validation-callback' =>
function( $reason ) {
121 return $this->
msg(
'spamprotectionmatch', $match )->parse();
126 'label-message' =>
'changecontentmodel-reason-label',
137 foreach ( $models
as $model ) {
139 if ( !
$handler->supportsDirectEditing() ) {
159 if ( $data[
'pagetitle'] ===
'' ) {
167 throw new RuntimeException(
"Form submission was not POSTed" );
177 $this->title->getUserPermissionsErrors(
'editcontentmodel',
$user ),
179 $this->title->getUserPermissionsErrors(
'edit',
$user ),
181 $titleWithNewContentModel->getUserPermissionsErrors(
'editcontentmodel',
$user ),
183 $titleWithNewContentModel->getUserPermissionsErrors(
'edit',
$user )
187 $wikitext =
$out->formatPermissionsErrorMessage( $errors );
193 if ( $this->oldRevision ===
null ) {
194 $this->oldRevision =
$page->getRevision() ?:
false;
196 $oldModel = $this->title->getContentModel();
197 if ( $this->oldRevision ) {
198 $oldContent = $this->oldRevision->getContent();
201 $oldContent->getNativeData(),
$this->title, $data[
'model']
205 $this->
msg(
'changecontentmodel-cannot-convert' )
207 $this->title->getPrefixedText(),
218 if (
$user->pingLimiter(
'editcontentmodel' ) ) {
224 if (
$user->isAllowed(
'bot' ) ) {
228 $log =
new ManualLogEntry(
'contentmodel', $this->oldRevision ?
'change' :
'new' );
229 $log->setPerformer(
$user );
230 $log->setTarget( $this->title );
231 $log->setComment( $data[
'reason'] );
232 $log->setParameters( [
233 '4::oldmodel' => $oldModel,
234 '5::newmodel' => $data[
'model']
239 $reason = $formatter->getPlainActionText();
240 if ( $data[
'reason'] !==
'' ) {
241 $reason .= $this->
msg(
'colon-separator' )->inContentLanguage()->text() . $data[
'reason'];
243 # Truncate for whole multibyte characters.
248 $derivativeContext->setTitle( $this->title );
249 $derivativeContext->setWikiPage(
$page );
252 [ $derivativeContext, $newContent,
$status, $reason,
257 $status->fatal(
'hookaborted' );
266 $this->oldRevision ? $this->oldRevision->getId() :
false,
273 $logid = $log->insert();
274 $log->publish( $logid );
281 $out->setPageTitle( $this->
msg(
'changecontentmodel-success-title' ) );
282 $out->addWikiMsg(
'changecontentmodel-success-text', $this->
title );
static getForModelID( $modelId)
Returns the ContentHandler singleton for the given model ID.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
getOptionsForTitle(Title $title=null)
wfMergeErrorArrays()
Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g.
Revision bool null $oldRevision
A Revision object, false if no revision exists, null if not loaded yet.
getOutput()
Get the OutputPage being used for this instance.
postText()
Add post-text to the form.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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
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 account $user
getPrefixedText()
Get the prefixed title with spaces.
static newFatal( $message)
Factory function for fatal errors.
Special page which uses an HTMLForm to handle processing.
static newExtraneousContext(Title $title, $request=[])
Create a new extraneous context.
doesWrites()
Indicates whether this special page may perform database writes.
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
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
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target.
An IContextSource implementation which will inherit context from another source but allow individual ...
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
prefixSearchString( $search, $limit, $offset)
Perform a regular substring search for prefixSearchSubpages.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
getFormFields()
Get an HTMLForm descriptor array.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
static getContentModels()
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
onSuccess()
Do something exciting on successful processing of the form, most likely to show a confirmation messag...
Class to simplify the use of log pages.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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 please use GetContentModels hook to make them known to core 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
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Show an error when the user hits a rate limit.
getUser()
Shortcut to get the User executing this instance.
when a variable name is used in a it is silently declared as a new masking the global
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
onSubmit(array $data)
Process the form on POST submission.
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
getContext()
Gets the context this SpecialPage is executed in.
static newFromTextThrow( $text, $defaultNamespace=NS_MAIN)
Like Title::newFromText(), but throws MalformedTitleException when the title is invalid,...
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
static getLocalizedName( $name, Language $lang=null)
Returns the localized name for a given content model.
msg()
Wrapper around wfMessage that sets the current context.
string $par
The sub-page of the special page.
static matchSummarySpamRegex( $text)
Check given input text against $wgSummarySpamRegex, and return the text of the first match.
getRequest()
Get the WebRequest being used for this instance.
getContentModel( $flags=0)
Get the page's content model id, see the CONTENT_MODEL_XXX constants.
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
getDisplayFormat()
Get display format for the form.
setParameter( $par)
Maybe do something interesting with the subpage parameter.
Represents a title within MediaWiki.
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
Class for creating log entries manually, to inject them into the database.
setContentModel( $model)
Set a proposed content model for the page for permissions checking.
An error page which can definitely be safely rendered using the OutputPage.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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
it s the revision text itself In either if gzip is the revision text is gzipped $flags
the array() calling protocol came about after MediaWiki 1.4rc1.
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 content language as $wgContLang
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