39 parent::__construct(
'Upload',
'upload' );
96 $this->mSourceType =
$request->getVal(
'wpSourceType',
'file' );
98 $this->mUploadClicked =
$request->wasPosted()
99 && (
$request->getCheck(
'wpUpload' )
100 ||
$request->getCheck(
'wpUploadIgnoreWarning' ) );
103 $this->mDesiredDestName =
$request->getText(
'wpDestFile' );
104 if ( !$this->mDesiredDestName &&
$request->getFileName(
'wpUploadFile' ) !== null ) {
105 $this->mDesiredDestName =
$request->getFileName(
'wpUploadFile' );
107 $this->mLicense =
$request->getText(
'wpLicense' );
109 $this->mDestWarningAck =
$request->getText(
'wpDestFileWarningAck' );
110 $this->mIgnoreWarning =
$request->getCheck(
'wpIgnoreWarning' )
111 ||
$request->getCheck(
'wpUploadIgnoreWarning' );
112 $this->mWatchthis =
$request->getBool(
'wpWatchthis' ) && $this->
getUser()->isLoggedIn();
113 $this->mCopyrightStatus =
$request->getText(
'wpUploadCopyStatus' );
114 $this->mCopyrightSource =
$request->getText(
'wpUploadSource' );
116 $this->mForReUpload =
$request->getBool(
'wpForReUpload' );
118 $commentDefault =
'';
119 $commentMsg =
wfMessage(
'upload-default-description' )->inContentLanguage();
120 if ( !$this->mForReUpload && !$commentMsg->isDisabled() ) {
121 $commentDefault = $commentMsg->plain();
123 $this->mComment =
$request->getText(
'wpUploadDescription', $commentDefault );
125 $this->mCancelUpload =
$request->getCheck(
'wpCancelUpload' )
126 ||
$request->getCheck(
'wpReUpload' );
129 $token =
$request->getVal(
'wpEditToken' );
130 $this->mTokenOk = $this->
getUser()->matchEditToken( $token );
132 $this->uploadFormTextTop =
'';
133 $this->uploadFormTextAfterSummary =
'';
165 # Check uploading enabled
167 throw new ErrorPageError(
'uploaddisabled',
'uploaddisabledtext' );
175 if ( $permissionRequired !==
true ) {
180 if ( $user->isBlocked() ) {
185 if ( $user->isBlockedGlobally() ) {
189 # Check whether we actually want to allow changing stuff
194 # Unsave the temporary file in case this was a cancelled upload
195 if ( $this->mCancelUpload ) {
197 # Something went wrong, so unsaveUploadedFile showed a warning
202 # Process upload or show a form
204 $this->mTokenOk && !$this->mCancelUpload &&
205 ( $this->mUpload && $this->mUploadClicked )
209 # Backwards compatibility hook
212 if ( !Hooks::run(
'UploadForm:initial', [ &$upload ] ) ) {
213 wfDebug(
"Hook 'UploadForm:initial' broke output of the upload form\n" );
221 if ( $this->mUpload ) {
222 $this->mUpload->cleanupTempFile();
232 # Add links if file was previously deleted
233 if ( $this->mDesiredDestName ) {
252 protected function getUploadForm( $message =
'', $sessionKey =
'', $hideIgnoreWarning =
false ) {
258 'forreupload' => $this->mForReUpload,
259 'sessionkey' => $sessionKey,
260 'hideignorewarning' => $hideIgnoreWarning,
261 'destwarningack' => (
bool)$this->mDestWarningAck,
263 'description' => $this->mComment,
264 'texttop' => $this->uploadFormTextTop,
265 'textaftersummary' => $this->uploadFormTextAfterSummary,
266 'destfile' => $this->mDesiredDestName,
269 # Check the token, but only if necessary
271 !$this->mTokenOk && !$this->mCancelUpload &&
272 ( $this->mUpload && $this->mUploadClicked )
274 $form->addPreText( $this->
msg(
'session_fail_preview' )->parse() );
277 # Give a notice if the user is uploading a file that has been deleted or moved
278 # Note that this is independent from the message 'filewasdeleted'
279 $desiredTitleObj = Title::makeTitleSafe(
NS_FILE, $this->mDesiredDestName );
281 if ( $desiredTitleObj instanceof
Title && !$desiredTitleObj->
exists() ) {
287 'conds' => [
'log_action != ' .
$dbr->addQuotes(
'revision' ) ],
288 'showIfEmpty' =>
false,
289 'msgKey' => [
'upload-recreate-warning' ] ]
292 $form->addPreText( $delNotice );
295 $form->addPreText(
'<div id="uploadtext">' .
296 $this->
msg(
'uploadtext', [ $this->mDesiredDestName ] )->parseAsBlock() .
298 # Add upload error message
299 $form->addPreText( $message );
302 $uploadFooter = $this->
msg(
'uploadfooter' );
303 if ( !$uploadFooter->isDisabled() ) {
304 $form->addPostText(
'<div id="mw-upload-footer-message">'
305 . $uploadFooter->parseAsBlock() .
"</div>\n" );
315 $title = Title::makeTitleSafe(
NS_FILE, $this->mDesiredDestName );
318 if ( $title instanceof
Title ) {
319 $count = $title->isDeleted();
320 if ( $count > 0 && $user->isAllowed(
'deletedhistory' ) ) {
323 $this->msg(
'restorelink' )->numParams( $count )->text()
325 $link = $this->
msg( $user->isAllowed(
'delete' ) ?
'thisisdeleted' :
'viewdeleted' )
326 ->rawParams( $restorelink )->parseAsBlock();
327 $this->
getOutput()->addHTML(
"<div id=\"contentSub2\">{$link}</div>" );
344 $stashStatus = $this->mUpload->tryStashFile( $this->
getUser() );
345 if ( $stashStatus->isGood() ) {
346 $sessionKey = $stashStatus->getValue()->getFileKey();
347 $uploadWarning =
'upload-tryagain';
350 $uploadWarning =
'upload-tryagain-nostash';
352 $message =
'<h2>' . $this->
msg(
'uploaderror' )->escaped() .
"</h2>\n" .
353 '<div class="error">' . $message .
"</div>\n";
356 $form->setSubmitText( $this->
msg( $uploadWarning )->escaped() );
369 # If there are no warnings, or warnings we can ignore, return early.
370 # mDestWarningAck is set when some javascript has shown the warning
371 # to the user. mForReUpload is set when the user clicks the "upload a
373 if ( !$warnings || ( count( $warnings ) == 1
374 && isset( $warnings[
'exists'] )
375 && ( $this->mDestWarningAck || $this->mForReUpload ) )
380 $stashStatus = $this->mUpload->tryStashFile( $this->
getUser() );
381 if ( $stashStatus->isGood() ) {
382 $sessionKey = $stashStatus->getValue()->getFileKey();
383 $uploadWarning =
'uploadwarning-text';
386 $uploadWarning =
'uploadwarning-text-nostash';
390 $this->
getOutput()->addModuleStyles(
'mediawiki.special.upload.styles' );
393 $warningHtml =
'<h2>' . $this->
msg(
'uploadwarning' )->escaped() .
"</h2>\n"
394 .
'<div class="mw-destfile-warning"><ul>';
395 foreach ( $warnings as $warning =>
$args ) {
396 if ( $warning ==
'badfilename' ) {
397 $this->mDesiredDestName = Title::makeTitle(
NS_FILE,
$args )->getText();
399 if ( $warning ==
'exists' ) {
401 } elseif ( $warning ==
'no-change' ) {
403 $filename = $file->getTitle()->getPrefixedText();
404 $msg =
"\t<li>" .
wfMessage(
'fileexists-no-change', $filename )->parse() .
"</li>\n";
405 } elseif ( $warning ==
'duplicate-version' ) {
407 $count = count(
$args );
408 $filename = $file->getTitle()->getPrefixedText();
409 $message =
wfMessage(
'fileexists-duplicate-version' )
410 ->params( $filename )
411 ->numParams( $count );
412 $msg =
"\t<li>" . $message->parse() .
"</li>\n";
413 } elseif ( $warning ==
'was-deleted' ) {
414 # If the file existed before and was deleted, warn the user of this
422 'page' => Title::makeTitle(
NS_FILE,
$args )->getPrefixedText(),
425 $msg =
"\t<li>" .
wfMessage(
'filewasdeleted' )->rawParams( $llink )->parse() .
"</li>\n";
426 } elseif ( $warning ==
'duplicate' ) {
428 } elseif ( $warning ==
'duplicate-archive' ) {
429 if (
$args ===
'' ) {
430 $msg =
"\t<li>" . $this->
msg(
'file-deleted-duplicate-notitle' )->parse()
433 $msg =
"\t<li>" . $this->
msg(
'file-deleted-duplicate',
434 Title::makeTitle(
NS_FILE,
$args )->getPrefixedText() )->parse()
438 if (
$args ===
true ) {
440 } elseif ( !is_array(
$args ) ) {
443 $msg =
"\t<li>" . $this->
msg( $warning,
$args )->parse() .
"</li>\n";
445 $warningHtml .= $msg;
447 $warningHtml .=
"</ul></div>\n";
448 $warningHtml .= $this->
msg( $uploadWarning )->parseAsBlock();
450 $form = $this->
getUploadForm( $warningHtml, $sessionKey,
true );
451 $form->setSubmitText( $this->
msg(
'upload-tryagain' )->
text() );
453 'name' =>
'wpUploadIgnoreWarning',
454 'value' => $this->
msg(
'ignorewarning' )->
text()
457 'name' =>
'wpCancelUpload',
458 'value' => $this->
msg(
'reuploaddesc' )->
text()
463 # Indicate that we showed a form
473 $message =
'<h2>' . $this->
msg(
'uploadwarning' )->escaped() .
"</h2>\n" .
474 '<div class="error">' . $message .
"</div>\n";
484 $status = $this->mUpload->fetchFile();
492 if ( !Hooks::run(
'UploadForm:BeforeProcessing', [ &$upload ] ) ) {
493 wfDebug(
"Hook 'UploadForm:BeforeProcessing' broke processing the file.\n" );
503 $details = $this->mUpload->verifyUpload();
511 $permErrors = $this->mUpload->verifyTitlePermissions( $this->
getUser() );
512 if ( $permErrors !==
true ) {
513 $code = array_shift( $permErrors[0] );
519 $this->mLocalFile = $this->mUpload->getLocalFile();
522 if ( !$this->mIgnoreWarning ) {
523 $warnings = $this->mUpload->checkWarnings();
532 $this->
msg(
'actionthrottledtext' )->escaped()
538 if ( !$this->mForReUpload ) {
540 $this->mCopyrightStatus, $this->mCopyrightSource, $this->
getConfig() );
545 $changeTags = $this->
getRequest()->getVal(
'wpChangeTags' );
546 if ( is_null( $changeTags ) || $changeTags ===
'' ) {
549 $changeTags = array_filter( array_map(
'trim', explode(
',', $changeTags ) ) );
554 $changeTags, $this->
getUser() );
555 if ( !$changeTagsStatus->isOK() ) {
562 $status = $this->mUpload->performUpload(
577 $this->mUploadSuccessful =
true;
580 Hooks::run(
'SpecialUploadComplete', [ &$upload ] );
581 $this->
getOutput()->redirect( $this->mLocalFile->getTitle()->getFullURL() );
596 if ( $config ===
null ) {
597 wfDebug( __METHOD__ .
' called without a Config instance passed to it' );
598 $config = MediaWikiServices::getInstance()->getMainConfig();
602 $forceUIMsgAsContentMsg = (
array)$config->get(
'ForceUIMsgAsContentMsg' );
607 foreach ( [
'license-header',
'filedesc',
'filestatus',
'filesource' ] as $msgName ) {
608 if ( in_array( $msgName, $forceUIMsgAsContentMsg ) ) {
609 $msg[$msgName] =
"{{int:$msgName}}";
611 $msg[$msgName] =
wfMessage( $msgName )->inContentLanguage()->text();
616 if ( $license !==
'' ) {
617 $licenseText =
'== ' . $msg[
'license-header'] .
" ==\n{{" . $license .
"}}\n";
620 $pageText = $comment .
"\n";
621 $headerText =
'== ' . $msg[
'filedesc'] .
' ==';
622 if ( $comment !==
'' && strpos( $comment, $headerText ) ===
false ) {
624 $pageText = $headerText .
"\n" . $pageText;
627 if ( $config->get(
'UseCopyrightUpload' ) ) {
628 $pageText .=
'== ' . $msg[
'filestatus'] .
" ==\n" . $copyStatus .
"\n";
629 $pageText .= $licenseText;
630 $pageText .=
'== ' . $msg[
'filesource'] .
" ==\n" .
$source;
632 $pageText .= $licenseText;
636 Hooks::run(
'UploadForm:getInitialPageText', [ &$pageText, $msg, $config ] );
654 if ( $this->
getUser()->getOption(
'watchdefault' ) ) {
659 $desiredTitleObj = Title::makeTitleSafe(
NS_FILE, $this->mDesiredDestName );
660 if ( $desiredTitleObj instanceof
Title && $this->
getUser()->isWatched( $desiredTitleObj ) ) {
666 if ( $local && $local->exists() ) {
672 return $this->
getUser()->getOption(
'watchcreations' ) ||
673 $this->
getUser()->getOption(
'watchuploads' );
684 switch ( $details[
'status'] ) {
691 $details[
'filtered'] )->parse() );
711 $msg = $this->
msg(
'filetype-banned-type' );
712 if ( isset( $details[
'blacklistedExt'] ) ) {
713 $msg->params( $this->
getLanguage()->commaList( $details[
'blacklistedExt'] ) );
715 $msg->params( $details[
'finalExt'] );
717 $extensions = array_unique( $this->
getConfig()->
get(
'FileExtensions' ) );
718 $msg->params( $this->
getLanguage()->commaList( $extensions ),
719 count( $extensions ) );
724 if ( isset( $details[
'blacklistedExt'] ) ) {
725 $msg->params( count( $details[
'blacklistedExt'] ) );
733 unset( $details[
'status'] );
734 $code = array_shift( $details[
'details'] );
738 if ( is_array( $details[
'error'] ) ) { # allow
hooks to
return error details in an array
739 $args = $details[
'error'];
740 $error = array_shift(
$args );
742 $error = $details[
'error'];
749 throw new MWException( __METHOD__ .
": Unknown value `{$details['status']}`" );
762 $success = $this->mUpload->unsaveUploadedFile();
764 $this->
getOutput()->showFileDeleteError( $this->mUpload->getTempPath() );
786 $file = $exists[
'file'];
787 $filename = $file->getTitle()->getPrefixedText();
790 if ( $exists[
'warning'] ==
'exists' ) {
792 $warnMsg =
wfMessage(
'fileexists', $filename );
793 } elseif ( $exists[
'warning'] ==
'page-exists' ) {
795 $warnMsg =
wfMessage(
'filepageexists', $filename );
796 } elseif ( $exists[
'warning'] ==
'exists-normalized' ) {
797 $warnMsg =
wfMessage(
'fileexists-extension', $filename,
798 $exists[
'normalizedFile']->
getTitle()->getPrefixedText() );
799 } elseif ( $exists[
'warning'] ==
'thumb' ) {
801 $warnMsg =
wfMessage(
'fileexists-thumbnail-yes',
802 $exists[
'thumbFile']->
getTitle()->getPrefixedText(), $filename );
803 } elseif ( $exists[
'warning'] ==
'thumb-name' ) {
805 $name = $file->getName();
806 $badPart = substr( $name, 0, strpos( $name,
'-' ) + 1 );
807 $warnMsg =
wfMessage(
'file-thumbnail-no', $badPart );
808 } elseif ( $exists[
'warning'] ==
'bad-prefix' ) {
809 $warnMsg =
wfMessage(
'filename-bad-prefix', $exists[
'prefix'] );
812 return $warnMsg ? $warnMsg->title( $file->getTitle() )->parse() :
'';
826 $gallery->setShowBytes(
false );
827 $gallery->setShowDimensions(
false );
828 foreach ( $dupes as $file ) {
829 $gallery->add( $file->getTitle() );
833 $this->
msg(
'file-exists-duplicate' )->numParams( count( $dupes ) )->parse() .
834 $gallery->toHTML() .
"</li>\n";
851 return $bitmapHandler->autoRotateEnabled();
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfLocalFile( $title)
Get an object referring to a locally registered file.
Generic handler for bitmap images.
An IContextSource implementation which will inherit context from another source but allow individual ...
An error page which can definitely be safely rendered using the OutputPage.
WebRequest clone which takes values from a provided array.
static factory( $mode=false, IContextSource $context=null)
Get a new image gallery.
Class to represent a local file in the wiki's own database.
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
Show an error when a user tries to do something they do not have the necessary permissions for.
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
getContext()
Gets the context this SpecialPage is executed in.
msg( $key)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getRequest()
Get the WebRequest being used for this instance.
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
getPageTitle( $subpage=false)
Get a self-referential title object.
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
getLanguage()
Shortcut to get user's language.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
MediaWiki Linker LinkRenderer null $linkRenderer
getTitle( $subpage=false)
Get a self-referential title object.
Form for handling uploads and special page.
processVerificationError( $details)
Provides output to the user for a result of UploadBase::verifyUpload.
showViewDeletedLinks()
Shows the "view X deleted revivions link"".
getWatchCheck()
See if we should check the 'watch this page' checkbox on the form based on the user's preferences and...
loadRequest()
Initialize instance variables from request and create an Upload handler.
static getInitialPageText( $comment='', $license='', $copyStatus='', $source='', Config $config=null)
Get the initial image page text based on a comment and optional file status information.
showUploadWarning( $warnings)
Stashes the upload, shows the main form, but adds a "continue anyway button".
$uploadFormTextTop
Text injection points for hooks not using HTMLForm.
bool $mCancelUpload
The user clicked "Cancel and return to upload form" button.
unsaveUploadedFile()
Remove a temporarily kept file stashed by saveTempUploadedFile().
userCanExecute(User $user)
This page can be shown if uploading is enabled.
static getExistsWarning( $exists)
Formats a result of UploadBase::getExistsWarning as HTML This check is static and can be done pre-upl...
string $mDesiredDestName
User input variables from the "description" section.
showRecoverableUploadError( $message)
Stashes the upload and shows the main upload form.
$mDestWarningAck
Hidden variables.
getDupeWarning( $dupes)
Construct a warning and a gallery from an array of duplicate files.
showUploadForm( $form)
Show the main upload form.
__construct( $request=null)
Get data POSTed through the form and assign them to the object.
WebRequest FauxRequest $mRequest
Misc variables.
processUpload()
Do the upload.
bool $mUploadSuccessful
Subclasses can use this to determine whether a file was uploaded.
$uploadFormTextAfterSummary
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
execute( $par)
Special page entry point.
getUploadForm( $message='', $sessionKey='', $hideIgnoreWarning=false)
Get an UploadForm instance with title and text properly set.
doesWrites()
Indicates whether this special page may perform database writes.
bool $mForReUpload
The user followed an "overwrite this file" link.
$mIgnoreWarning
User input variables from the root section.
showUploadError( $message)
Show the upload form with error message, but do not stash the file.
static rotationEnabled()
Should we rotate images in the preview on Special:Upload.
Represents a title within MediaWiki.
exists( $flags=0)
Check if page exists.
UploadBase and subclasses are the backend of MediaWiki's file uploads.
static createFromRequest(&$request, $type=null)
Create a form of UploadBase depending on wpSourceType and initializes it.
static isEnabled()
Returns true if uploads are enabled.
const WINDOWS_NONASCII_FILENAME
static isThrottled( $user)
Returns true if the user has surpassed the upload rate limit, false otherwise.
const MIN_LENGTH_PARTNAME
static isAllowed( $user)
Returns true if the user can use this upload module or else a string identifying the missing permissi...
Implements uploading from previously stored file.
Show an error when the user tries to do something whilst blocked.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
the array() calling protocol came about after MediaWiki 1.4rc1.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
Status::newGood()` to allow deletion, and then `return false` from the hook function. Ensure you consume the 'ChangeTagAfterDelete' hook to carry out custom deletion actions. $tag:name of the tag $user:user initiating the action & $status:Status object. See above. 'ChangeTagsListActive':Allows you to nominate which of the tags your extension uses are in active use. & $tags:list of all active tags. Append to this array. 'ChangeTagsAfterUpdateTags':Called after tags have been updated with the ChangeTags::updateTags function. Params:$addedTags:tags effectively added in the update $removedTags:tags effectively removed in the update $prevTags:tags that were present prior to the update $rc_id:recentchanges table id $rev_id:revision table id $log_id:logging table id $params:tag params $rc:RecentChange being tagged when the tagging accompanies the action or null $user:User who performed the tagging when the tagging is subsequent to the action or null 'ChangeTagsAllowedAdd':Called when checking if a user can add tags to a change. & $allowedTags:List of all the tags the user is allowed to add. Any tags the user wants to add( $addTags) that are not in this array will cause it to fail. You may add or remove tags to this array as required. $addTags:List of tags user intends to add. $user:User who is adding the tags. 'ChangeUserGroups':Called before user groups are changed. $performer:The User who will perform the change $user:The User whose groups will be changed & $add:The groups that will be added & $remove:The groups that will be removed 'Collation::factory':Called if $wgCategoryCollation is an unknown collation. $collationName:Name of the collation in question & $collationObject:Null. Replace with a subclass of the Collation class that implements the collation given in $collationName. 'ConfirmEmailComplete':Called after a user 's email has been confirmed successfully. $user:user(object) whose email is being confirmed 'ContentAlterParserOutput':Modify parser output for a given content object. Called by Content::getParserOutput after parsing has finished. Can be used for changes that depend on the result of the parsing but have to be done before LinksUpdate is called(such as adding tracking categories based on the rendered HTML). $content:The Content to render $title:Title of the page, as context $parserOutput:ParserOutput to manipulate 'ContentGetParserOutput':Customize parser output for a given content object, called by AbstractContent::getParserOutput. May be used to override the normal model-specific rendering of page content. $content:The Content to render $title:Title of the page, as context $revId:The revision ID, as context $options:ParserOptions for rendering. To avoid confusing the parser cache, the output can only depend on parameters provided to this hook function, not on global state. $generateHtml:boolean, indicating whether full HTML should be generated. If false, generation of HTML may be skipped, but other information should still be present in the ParserOutput object. & $output:ParserOutput, to manipulate or replace 'ContentHandlerDefaultModelFor':Called when the default content model is determined for a given title. May be used to assign a different model for that title. $title:the Title in question & $model:the model name. Use with CONTENT_MODEL_XXX constants. 'ContentHandlerForModelID':Called when a ContentHandler is requested for a given content model name, but no entry for that model exists in $wgContentHandlers. Note:if your extension implements additional models via this hook, please use GetContentModels hook to make them known to core. $modeName:the requested content model name & $handler:set this to a ContentHandler object, if desired. 'ContentModelCanBeUsedOn':Called to determine whether that content model can be used on a given page. This is especially useful to prevent some content models to be used in some special location. $contentModel:ID of the content model in question $title:the Title in question. & $ok:Output parameter, 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. 'ContribsPager::getQueryInfo':Before the contributions query is about to run & $pager:Pager object for contributions & $queryInfo:The query for the contribs Pager 'ContribsPager::reallyDoQuery':Called before really executing the query for My Contributions & $data:an array of results of all contribs queries $pager:The ContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'ContributionsLineEnding':Called before a contributions HTML line is finished $page:SpecialPage object for contributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'ContributionsToolLinks':Change tool links above Special:Contributions $id:User identifier $title:User page title & $tools:Array of tool links $specialPage:SpecialPage instance for context and services. Can be either SpecialContributions or DeletedContributionsPage. Extensions should type hint against a generic SpecialPage though. 'ConvertContent':Called by AbstractContent::convert when a conversion to another content model is requested. Handler functions that modify $result should generally return false to disable further attempts at conversion. $content:The Content object to be converted. $toModel:The ID of the content model to convert to. $lossy: boolean indicating whether lossy conversion is allowed. & $result:Output parameter, in case the handler function wants to provide a converted Content object. Note that $result->getContentModel() must return $toModel. 'CustomEditor':When invoking the page editor Return true to allow the normal editor to be used, or false if implementing a custom editor, e.g. for a special namespace, etc. $article:Article being edited $user:User performing the edit 'DatabaseOraclePostInit':Called after initialising an Oracle database $db:the DatabaseOracle object 'DeletedContribsPager::reallyDoQuery':Called before really executing the query for Special:DeletedContributions Similar to ContribsPager::reallyDoQuery & $data:an array of results of all contribs queries $pager:The DeletedContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'DeletedContributionsLineEnding':Called before a DeletedContributions HTML line is finished. Similar to ContributionsLineEnding $page:SpecialPage object for DeletedContributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'DeleteUnknownPreferences':Called by the cleanupPreferences.php maintenance script to build a WHERE clause with which to delete preferences that are not known about. This hook is used by extensions that have dynamically-named preferences that should not be deleted in the usual cleanup process. For example, the Gadgets extension creates preferences prefixed with 'gadget-', and so anything with that prefix is excluded from the deletion. &where:An array that will be passed as the $cond parameter to IDatabase::select() to determine what will be deleted from the user_properties table. $db:The IDatabase object, useful for accessing $db->buildLike() etc. 'DifferenceEngineAfterLoadNewText':called in DifferenceEngine::loadNewText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before returning true from this function. $differenceEngine:DifferenceEngine object 'DifferenceEngineLoadTextAfterNewContentIsLoaded':called in DifferenceEngine::loadText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before checking if the variable 's value is null. This hook can be used to inject content into said class member variable. $differenceEngine:DifferenceEngine object 'DifferenceEngineMarkPatrolledLink':Allows extensions to change the "mark as patrolled" link which is shown both on the diff header as well as on the bottom of a page, usually wrapped in a span element which has class="patrollink". $differenceEngine:DifferenceEngine object & $markAsPatrolledLink:The "mark as patrolled" link HTML(string) $rcid:Recent change ID(rc_id) for this change(int) 'DifferenceEngineMarkPatrolledRCID':Allows extensions to possibly change the rcid parameter. For example the rcid might be set to zero due to the user being the same as the performer of the change but an extension might still want to show it under certain conditions. & $rcid:rc_id(int) of the change or 0 $differenceEngine:DifferenceEngine object $change:RecentChange object $user:User object representing the current user 'DifferenceEngineNewHeader':Allows extensions to change the $newHeader variable, which contains information about the new revision, such as the revision 's author, whether the revision was marked as a minor edit or not, etc. $differenceEngine:DifferenceEngine object & $newHeader:The string containing the various #mw-diff-otitle[1-5] divs, which include things like revision author info, revision comment, RevisionDelete link and more $formattedRevisionTools:Array containing revision tools, some of which may have been injected with the DiffRevisionTools hook $nextlink:String containing the link to the next revision(if any) $status
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
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
Using a hook running we can avoid having all this option specific stuff in our mainline code Using hooks
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Interface for configuration instances.