62 $this->mPage->setFile( $file );
63 $this->displayImg = $file;
64 $this->fileLoaded =
true;
68 if ( $this->fileLoaded ) {
71 $this->fileLoaded =
true;
73 $this->displayImg = $img =
false;
75 Hooks::run(
'ImagePageFindFile', [ $this, &$img, &$this->displayImg ] );
82 $this->mPage->setFile( $img );
83 if ( !$this->displayImg ) {
84 $this->displayImg = $img;
86 $this->repo = $img->getRepo();
94 $this->
getContext()->getOutput()->setArticleBodyOnly(
true );
109 if ( $this->
getTitle()->getNamespace() !=
NS_FILE || ( $diff !==
null && $diffOnly ) ) {
116 if ( $this->
getTitle()->getNamespace() ==
NS_FILE && $this->mPage->getFile()->getRedirected() ) {
117 if ( $this->
getTitle()->getDBkey() == $this->mPage->getFile()->getName() || $diff !==
null ) {
118 $request->setVal(
'diffonly',
'true' );
125 if (
$wgShowEXIF && $this->displayImg->exists() ) {
127 $formattedMetadata = $this->displayImg->formatMetadata( $this->
getContext() );
128 $showmeta = $formattedMetadata !==
false;
133 if ( !$diff && $this->displayImg->exists() ) {
141 # No need to display noarticletext, we use our own message, output in openShowImage()
142 if ( $this->mPage->getId() ) {
143 # NS_FILE is in the user language, but this section (the actual wikitext)
144 # should be in page content language
145 $pageLang = $this->
getTitle()->getPageViewLanguage();
146 $out->addHTML( Xml::openElement(
'div', [
'id' =>
'mw-imagepage-content',
147 'lang' => $pageLang->getHtmlCode(),
'dir' => $pageLang->getDir(),
148 'class' =>
'mw-content-' . $pageLang->getDir() ] ) );
152 $out->addHTML( Xml::closeElement(
'div' ) );
154 # Just need to set the right headers
155 $out->setArticleFlag(
true );
156 $out->setPageTitle( $this->
getTitle()->getPrefixedText() );
160 # Show shared description, if needed
161 if ( $this->mExtraDescription ) {
162 $fol = $this->
getContext()->msg(
'shareddescriptionfollows' );
163 if ( !$fol->isDisabled() ) {
164 $out->addWikiText( $fol->plain() );
166 $out->addHTML(
'<div id="shared-image-desc">' . $this->mExtraDescription .
"</div>\n" );
173 $out->addHTML( Xml::element(
'h2',
174 [
'id' =>
'filelinks' ],
177 # @todo FIXME: For some freaky reason, we can't redirect to foreign images.
178 # Yet we return metadata about the target. Definitely an issue in the FileRepo
181 # Allow extensions to add something after the image links
183 Hooks::run(
'ImagePageAfterImageLinks', [ $this, &
$html ] );
189 $out->addHTML( Xml::element(
191 [
'id' =>
'metadata' ],
194 $out->addModules( [
'mediawiki.action.view.metadata' ] );
198 if ( !$this->repo->isLocal() ) {
199 $css = $this->repo->getDescriptionStylesheetUrl();
205 $out->addModuleStyles( [
207 'mediawiki.action.view.filepage',
227 '<li><a href="#file">' . $this->
getContext()->msg(
'file-anchor-link' )->escaped() .
'</a></li>',
228 '<li><a href="#filehistory">' . $this->
getContext()->msg(
'filehist' )->escaped() .
'</a></li>',
229 '<li><a href="#filelinks">' . $this->
getContext()->msg(
'imagelinks' )->escaped() .
'</a></li>',
232 Hooks::run(
'ImagePageShowTOC', [ $this, &$r ] );
235 $r[] =
'<li><a href="#metadata">' .
236 $this->
getContext()->msg(
'metadata' )->escaped() .
240 return '<ul id="filetoc">' . implode(
"\n", $r ) .
'</ul>';
252 $r =
"<div class=\"mw-imagepage-section-metadata\">";
253 $r .= $this->
getContext()->msg(
'metadata-help' )->plain();
256 $r .=
"<table id=\"mw_metadata\" class=\"mw_metadata collapsed\">\n";
257 foreach ( $metadata
as $type => $stuff ) {
258 foreach ( $stuff
as $v ) {
259 $class = str_replace(
' ',
'_', $v[
'id'] );
260 if (
$type ==
'collapsed' ) {
261 $class .=
' mw-metadata-collapsible';
263 $r .= Html::rawElement(
'tr',
264 [
'class' => $class ],
265 Html::rawElement(
'th', [], $v[
'name'] )
266 . Html::rawElement(
'td', [], $v[
'value'] )
270 $r .=
"</table>\n</div>\n";
285 if ( $this->mPage->getFile() && !$this->mPage->getFile()->isLocal() && 0 == $this->getId() ) {
288 return parent::getEmptyPageParserOutput(
$options );
292 $handler = $this->displayImg->getHandler();
297 $requestLanguage =
$request->getVal(
'lang' );
298 if ( !is_null( $requestLanguage ) ) {
299 if (
$handler->validateParam(
'lang', $requestLanguage ) ) {
300 return $requestLanguage;
304 return $handler->getDefaultRenderLanguage( $this->displayImg );
314 $dirmark =
$lang->getDirMarkEntity();
319 $maxHeight = $max[1];
321 if ( $this->displayImg->exists() ) {
323 $page =
$request->getIntOrNull(
'page' );
324 if ( is_null( $page ) ) {
332 if ( !is_null( $renderLang ) ) {
336 $width_orig = $this->displayImg->getWidth( $page );
337 $width = $width_orig;
338 $height_orig = $this->displayImg->getHeight( $page );
339 $height = $height_orig;
342 $linktext = $filename;
347 Hooks::run(
'ImageOpenShowImageInlineBefore', [ &$imagePage, &
$out ] );
349 if ( $this->displayImg->allowInlineDisplay() ) {
351 # "Download high res version" link below the image
352 # $msgsize = $this->getContext()->msg( 'file-info-size', $width_orig, $height_orig,
353 # Linker::formatSize( $this->displayImg->getSize() ), $mime )->escaped();
354 # We'll show a thumbnail of this image
355 if ( $width > $maxWidth || $height > $maxHeight || $this->displayImg->isVectorized() ) {
357 $maxWidth, $maxHeight, $width, $height
359 $linktext = $this->
getContext()->msg(
'show-big-image' )->escaped();
361 $thumbSizes = $this->
getThumbSizes( $width_orig, $height_orig );
362 # Generate thumbnails or thumbnail links as needed...
364 foreach ( $thumbSizes
as $size ) {
373 if ( ( ( $size[0] <= $width_orig && $size[1] <= $height_orig )
374 || ( $this->displayImg->isVectorized()
377 && $size[0] != $width && $size[1] != $height
381 $otherSizes[] = $sizeLink;
385 $otherSizes = array_unique( $otherSizes );
389 if ( count( $otherSizes ) ) {
393 [
'class' =>
'mw-filepage-other-resolutions' ],
394 $this->
getContext()->msg(
'show-big-image-other' )
395 ->rawParams(
$lang->pipeList( $otherSizes ) )
396 ->params( count( $otherSizes ) )
400 } elseif ( $width == 0 && $height == 0 ) {
401 # Some sort of audio file that doesn't have dimensions
402 # Don't output a no hi res message for such a file
405 # Image is small enough to show full size on image page
406 $msgsmall = $this->
getContext()->msg(
'file-nohires' )->parse();
411 $thumbnail = $this->displayImg->transform(
$params );
414 $anchorclose = Html::rawElement(
416 [
'class' =>
'mw-filepage-resolutioninfo' ],
420 $isMulti = $this->displayImg->isMultipage() && $this->displayImg->pageCount() > 1;
422 $out->addModules(
'mediawiki.page.image.pagination' );
423 $out->addHTML(
'<table class="multipageimage"><tr><td>' );
428 'alt' => $this->displayImg->getTitle()->getPrefixedText(),
431 $out->addHTML(
'<div class="fullImageLink" id="file">' .
433 $anchorclose .
"</div>\n" );
437 $count = $this->displayImg->pageCount();
440 $label = $this->
getContext()->msg(
'imgmultipageprev' )->text();
445 htmlspecialchars( $label ),
447 [
'page' => $page - 1 ]
455 [
'page' => $page - 1 ]
461 if ( $page < $count ) {
462 $label = $this->
getContext()->msg(
'imgmultipagenext' )->text();
465 htmlspecialchars( $label ),
467 [
'page' => $page + 1 ]
475 [
'page' => $page + 1 ]
484 'name' =>
'pageselector',
488 for ( $i = 1; $i <= $count; $i++ ) {
489 $options[] = Xml::option(
$lang->formatNum( $i ), $i, $i == $page );
491 $select = Xml::tags(
'select',
492 [
'id' =>
'pageselector',
'name' =>
'page' ],
496 '</td><td><div class="multipageimagenavbox">' .
497 Xml::openElement(
'form', $formParams ) .
498 Html::hidden(
'title', $this->
getTitle()->getPrefixedDBkey() ) .
499 $this->
getContext()->msg(
'imgmultigoto' )->rawParams( $select )->parse() .
500 $this->
getContext()->msg(
'word-separator' )->escaped() .
501 Xml::submitButton( $this->
getContext()->msg(
'imgmultigo' )->
text() ) .
502 Xml::closeElement(
'form' ) .
503 "<hr />$thumb1\n$thumb2<br style=\"clear: both\" /></div></td></tr></table>"
506 } elseif ( $this->displayImg->isSafeFile() ) {
507 # if direct link is allowed but it's not a renderable image, show an icon.
508 $icon = $this->displayImg->iconThumb();
510 $out->addHTML(
'<div class="fullImageLink" id="file">' .
511 $icon->toHtml( [
'file-link' =>
true ] ) .
515 $longDesc = $this->
getContext()->msg(
'parentheses', $this->displayImg->getLongDesc() )->text();
517 $handler = $this->displayImg->getHandler();
521 $warningConfig =
$handler->getWarningConfig( $this->displayImg );
523 if ( $warningConfig !==
null ) {
527 $output->addJsConfigVars(
'wgFileWarning', $warningConfig );
528 $output->addModules( $warningConfig[
'module'] );
529 $output->addModules(
'mediawiki.filewarning' );
533 $medialink =
"[[Media:$filename|$linktext]]";
535 if ( !$this->displayImg->isSafeFile() ) {
536 $warning = $this->
getContext()->msg(
'mediawarning' )->plain();
545 $out->addWikiText( <<<EOT
546<
div class=
"fullMedia"><span
class=
"dangerousLink">{$medialink}</span> $dirmark<span
class=
"fileInfo">$longDesc</span></
div>
547<
div class=
"mediaWarning">$warning</
div>
552 $out->addWikiText( <<<EOT
553<
div class=
"fullMedia">{$medialink} {$dirmark}<span
class=
"fileInfo">$longDesc</span>
559 $renderLangOptions = $this->displayImg->getAvailableLanguages();
560 if ( count( $renderLangOptions ) >= 1 ) {
565 if ( !$this->displayImg->canAnimateThumbIfAppropriate() ) {
571 $ext = $this->displayImg->getExtension();
573 'file-no-thumb-animation-' .
$ext,
574 'file-no-thumb-animation'
577 $out->addWikiText( <<<EOT
578<
div class=
"mw-noanimatethumb">{$noAnimMesg}</
div>
583 if ( !$this->displayImg->isLocal() ) {
587 # Image does not exist
588 if ( !$this->
getId() ) {
591 # No article exists either
592 # Show deletion log to be consistent with normal articles
595 [
'delete',
'move',
'protect' ],
596 $this->
getTitle()->getPrefixedText(),
599 'conds' => [
'log_action != ' .
$dbr->addQuotes(
'revision' ) ],
600 'showIfEmpty' =>
false,
601 'msgKey' => [
'moveddeleted-notice' ]
608 $uploadTitle = SpecialPage::getTitleFor(
'Upload' );
610 'filepage-nofile-link',
611 $uploadTitle->getFullURL( [
'wpDestFile' => $this->mPage->getFile()->getName() ] )
614 $nofile =
'filepage-nofile';
619 $out->setRobotPolicy(
'noindex,nofollow' );
620 $out->wrapWikiMsg(
"<div id='mw-imagepage-nofile' class='plainlinks'>\n$1\n</div>", $nofile );
621 if ( !$this->
getId() && $wgSend404Code ) {
624 $request->response()->statusHeader( 404 );
627 $out->setFileVersion( $this->displayImg );
638 if ( $sizeLinkBigImagePreview ) {
640 $previewTypeDiffers =
false;
641 $origExt = $thumbExt = $this->displayImg->getExtension();
642 if ( $this->displayImg->getHandler() ) {
643 $origMime = $this->displayImg->getMimeType();
645 $this->displayImg->getHandler()->normaliseParams( $this->displayImg, $typeParams );
646 list( $thumbExt, $thumbMime ) = $this->displayImg->getHandler()->getThumbType(
647 $origExt, $origMime, $typeParams );
648 if ( $thumbMime !== $origMime ) {
649 $previewTypeDiffers =
true;
652 if ( $previewTypeDiffers ) {
653 return $this->
getContext()->msg(
'show-big-image-preview-differ' )->
654 rawParams( $sizeLinkBigImagePreview )->
655 params( strtoupper( $origExt ) )->
656 params( strtoupper( $thumbExt ) )->
659 return $this->
getContext()->msg(
'show-big-image-preview' )->
660 rawParams( $sizeLinkBigImagePreview )->
678 $thumbnail = $this->displayImg->transform(
$params );
679 if ( $thumbnail && !$thumbnail->isError() ) {
680 return Html::rawElement(
'a', [
681 'href' => $thumbnail->getUrl(),
682 'class' =>
'mw-thumbnail-link'
683 ], $this->getContext()->msg(
'show-big-image-size' )->numParams(
684 $thumbnail->getWidth(), $thumbnail->getHeight()
698 $descUrl = $this->mPage->getFile()->getDescriptionUrl();
699 $descText = $this->mPage->getFile()->getDescriptionText( $this->
getContext()->getLanguage() );
702 if ( $descUrl && $this->mPage->getId() == 0 ) {
703 $out->setCanonicalUrl( $descUrl );
706 $wrap =
"<div class=\"sharedUploadNotice\">\n$1\n</div>\n";
713 $out->wrapWikiMsg( $wrap, [
'sharedupload-desc-here',
$repo, $descUrl ] );
714 } elseif ( $descUrl &&
717 $out->wrapWikiMsg( $wrap, [
'sharedupload-desc-there',
$repo, $descUrl ] );
719 $out->wrapWikiMsg( $wrap, [
'sharedupload',
$repo ],
'' );
723 $this->mExtraDescription = $descText;
729 $uploadTitle = SpecialPage::getTitleFor(
'Upload' );
730 return $uploadTitle->getFullURL( [
731 'wpDestFile' => $this->mPage->getFile()->getName(),
748 if ( !$this->mPage->getFile()->isLocal() ) {
753 $out->addHTML(
"<ul>\n" );
755 # "Upload a new version of this file" link
759 $this->mPage->getFile() )
765 $out->addHTML(
"<li id=\"mw-imagepage-reupload-link\">"
766 .
"<div class=\"plainlinks\">{$ulink}</div></li>\n" );
768 $out->addHTML(
"<li id=\"mw-imagepage-upload-disallowed\">"
769 . $this->
getContext()->msg(
'upload-disallowed-here' )->escaped() .
"</li>\n" );
772 $out->addHTML(
"</ul>\n" );
789 $out->addHTML( $pager->getBody() );
790 $out->preventClickjacking( $pager->getPreventClickjacking() );
792 $this->mPage->getFile()->resetHistory();
794 # Exist check because we don't want to show this on pages where an image
795 # doesn't exist along with the noimage message, that would suck. -ævar
796 if ( $this->mPage->getFile()->exists() ) {
810 [
'imagelinks',
'page' ],
811 [
'page_namespace',
'page_title',
'il_to' ],
812 [
'il_to' => $target,
'il_from = page_id' ],
814 [
'LIMIT' => $limit + 1,
'ORDER BY' =>
'il_from', ]
826 $redirects[$redir->getDBkey()] = [];
829 'page_title' => $redir->getDBkey(),
834 foreach (
$res as $row ) {
837 $count = count(
$rows );
839 $hasMore = $count > $limit;
840 if ( !$hasMore && count( $redirects ) ) {
842 $limit - count(
$rows ) + 1 );
843 foreach (
$res as $row ) {
844 $redirects[$row->il_to][] = $row;
847 $hasMore = (
$res->numRows() + count(
$rows ) ) > $limit;
852 Html::rawElement(
'div',
853 [
'id' =>
'mw-imagepage-nolinkstoimage' ],
"\n$1\n" ),
859 $out->addHTML(
"<div id='mw-imagepage-section-linkstoimage'>\n" );
861 $out->addWikiMsg(
'linkstoimage', $count );
864 $out->addWikiMsg(
'linkstoimage-more',
865 $this->
getContext()->getLanguage()->formatNum( $limit ),
866 $this->
getTitle()->getPrefixedDBkey()
871 Html::openElement(
'ul',
872 [
'class' =>
'mw-imagepage-linkstoimage' ] ) .
"\n"
877 usort(
$rows, [ $this,
'compare' ] );
881 foreach (
$rows as $element ) {
883 if ( $currentCount > $limit ) {
888 # Add a redirect=no to make redirect pages reachable
889 if ( isset( $redirects[$element->page_title] ) ) {
890 $query[
'redirect'] =
'no';
893 Title::makeTitle( $element->page_namespace, $element->page_title ),
896 if ( !isset( $redirects[$element->page_title] ) ) {
899 } elseif ( count( $redirects[$element->page_title] ) === 0 ) {
900 # Redirect without usages
901 $liContents = $this->
getContext()->msg(
'linkstoimage-redirect' )
902 ->rawParams(
$link,
'' )
905 # Redirect with usages
907 foreach ( $redirects[$element->page_title]
as $row ) {
909 if ( $currentCount > $limit ) {
913 $link2 =
Linker::linkKnown( Title::makeTitle( $row->page_namespace, $row->page_title ) );
914 $li .= Html::rawElement(
916 [
'class' =>
'mw-imagepage-linkstoimage-ns' . $element->page_namespace ],
921 $ul = Html::rawElement(
923 [
'class' =>
'mw-imagepage-redirectstofile' ],
926 $liContents = $this->
getContext()->msg(
'linkstoimage-redirect' )->rawParams(
929 $out->addHTML( Html::rawElement(
931 [
'class' =>
'mw-imagepage-linkstoimage-ns' . $element->page_namespace ],
937 $out->addHTML( Html::closeElement(
'ul' ) .
"\n" );
941 if ( $count > $limit ) {
942 $out->addWikiMsg(
'morelinkstoimage', $this->
getTitle()->getPrefixedDBkey() );
944 $out->addHTML( Html::closeElement(
'div' ) .
"\n" );
951 $dupes = $this->mPage->getDuplicates();
952 if ( count( $dupes ) == 0 ) {
956 $out->addHTML(
"<div id='mw-imagepage-section-duplicates'>\n" );
957 $out->addWikiMsg(
'duplicatesoffile',
958 $this->
getContext()->getLanguage()->formatNum( count( $dupes ) ), $this->
getTitle()->getDBkey()
960 $out->addHTML(
"<ul class='mw-imagepage-duplicates'>\n" );
965 foreach ( $dupes
as $file ) {
967 if ( $file->isLocal() ) {
971 $file->getTitle()->getPrefixedText() );
974 $file->getRepo()->getDisplayName()
977 $out->addHTML(
"<li>{$link} {$fromSrc}</li>\n" );
979 $out->addHTML(
"</ul></div>\n" );
985 public function delete() {
986 $file = $this->mPage->getFile();
987 if ( !$file->exists() || !$file->isLocal() || $file->getRedirected() ) {
1004 $out->setPageTitle( $this->
getContext()->msg(
'internalerror' ) );
1005 $out->setRobotPolicy(
'noindex,nofollow' );
1006 $out->setArticleRelated(
false );
1007 $out->enableClientCache(
false );
1008 $out->addWikiText( $description );
1020 return $a->page_namespace <=> $b->page_namespace
1021 ?: strcmp( $a->page_title, $b->page_title );
1035 $option =
$user->getIntOption( $optionName );
1062 $matchedRenderLang = $this->displayImg->getMatchedLanguage( $renderLang );
1064 foreach ( $langChoices
as $lang ) {
1067 $matchedRenderLang ===
$lang
1077 is_null( $matchedRenderLang )
1080 $select = Html::rawElement(
1082 [
'id' =>
'mw-imglangselector',
'name' =>
'lang' ],
1085 $submit = Xml::submitButton( $this->
getContext()->msg(
'img-lang-go' )->
text() );
1087 $formContents = $this->
getContext()->msg(
'img-lang-info' )
1088 ->rawParams( $select, $submit )
1090 $formContents .= Html::hidden(
'title', $this->
getTitle()->getPrefixedDBkey() );
1092 $langSelectLine = Html::rawElement(
'div', [
'id' =>
'mw-imglangselector-line' ],
1093 Html::rawElement(
'form', [
'action' =>
$wgScript ], $formContents )
1095 return $langSelectLine;
1106 if (
$name !==
'' ) {
1134 if ( !$maxWidth || !$maxHeight ) {
1136 throw new MWException(
'Using a choice from $wgImageLimits that is 0x0' );
1139 if ( !$width || !$height ) {
1143 # Calculate the thumbnail size.
1144 if ( $width <= $maxWidth && $height <= $maxHeight ) {
1146 } elseif ( $width / $height >= $maxWidth / $maxHeight ) {
1147 # The limiting factor is the width, not the height.
1148 $height = round( $height * $maxWidth / $width );
1150 # Note that $height <= $maxHeight now.
1152 $newwidth = floor( $width * $maxHeight / $height );
1153 $height = round( $height * $newwidth / $width );
1155 # Note that $height <= $maxHeight now, but might not be identical
1156 # because of rounding.
1158 return [ $width, $height ];
1171 if ( $this->displayImg->getRepo()->canTransformVia404() ) {
1179 $thumbSizes[] = [ $origWidth, $origHeight ];
1181 # Creating thumb links triggers thumbnail generation.
1182 # Just generate the thumb for the current users prefs.
1186 if ( !$this->displayImg->mustRender() ) {
1189 $thumbSizes[] = [ $origWidth, $origHeight ];
1200 return $this->mPage->getFile();
1208 return $this->mPage->isLocal();
1216 return $this->mPage->getDuplicates();
1224 $this->mPage->getForeignCategories();
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
$wgScript
The URL path to index.php.
$wgSend404Code
Some web hosts attempt to rewrite all responses with a 404 (not found) status code,...
$wgImageLimits
Limit images on image description pages to a user-selectable limit.
$wgSVGMaxSize
Don't scale a SVG larger than this.
$wgEnableUploads
Allow users to upload files.
$wgShowEXIF
Show Exif data, on by default if available.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfLocalFile( $title)
Get an object referring to a locally registered file.
wfFindFile( $title, $options=[])
Find a file.
wfMessageFallback(... $keys)
This function accepts multiple message keys and returns a message instance for the first message whic...
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Class for viewing MediaWiki article and history.
getContext()
Gets the context this Article is executed in.
getTitle()
Get the title object of the article.
getId()
Call to WikiPage function for backwards compatibility.
getUser( $audience=Revision::FOR_PUBLIC, User $user=null)
Call to WikiPage function for backwards compatibility.
Base class for file repositories.
getDisplayName()
Get the human-readable name of the repo.
Implements some public methods and some protected utility functions which are required by multiple ch...
Class for viewing MediaWiki file description pages.
getLanguageForRendering(WebRequest $request, File $file)
showError( $description)
Display an error with a wikitext description.
imageHistory()
If the page we've just displayed is in the "Image" namespace, we follow it with an upload history of ...
compare( $a, $b)
Callback for usort() to do link sorts by (namespace, title) Function copied from Title::compare()
createXmlOptionStringForLanguage( $lang, $selected)
getThumbSizes( $origWidth, $origHeight)
Get alternative thumbnail sizes.
getImageLimitsFromOption( $user, $optionName)
Returns the corresponding $wgImageLimits entry for the selected user option.
getDisplayWidthHeight( $maxWidth, $maxHeight, $width, $height)
Get the width and height to display image at.
makeSizeLink( $params, $width, $height)
Creates an thumbnail of specified size and returns an HTML link to it.
doRenderLangOpt(array $langChoices, $renderLang)
Output a drop-down box for language options for the file.
makeMetadataTable( $metadata)
Make a table with metadata to be shown in the output page.
render()
Handler for action=render Include body text only; none of the image extras.
getEmptyPageParserOutput(ParserOptions $options)
Overloading Article's getEmptyPageParserOutput method.
queryImageLinks( $target, $limit)
uploadLinksBox()
Print out the various links at the bottom of the image page, e.g.
printSharedImageText()
Show a notice that the file is from a shared repository.
closeShowImage()
For overloading.
showTOC( $metadata)
Create the TOC.
view()
This is the default action of the index.php entry point: just view the page of the given title.
getThumbPrevText( $params, $sizeLinkBigImagePreview)
Make the text under the image to say what size preview.
static linkKnown( $target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
static processResponsiveImages( $file, $thumb, $hp)
Process responsive images: add 1.5x and 2x subimages to the thumbnail, where applicable.
static makeThumbLinkObj(Title $title, $file, $label='', $alt='', $align='right', $params=[], $framed=false, $manualthumb="")
Make HTML for a thumbnail including image, border and caption.
static makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=[], $title=null)
Make an external link.
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
Set options of the Parser.
Represents a title within MediaWiki.
static userCanReUpload(User $user, File $img)
Check if a user is the last uploader.
static getDefaultOption( $opt)
Get a given default option value.
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
Special handling for file pages.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
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
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest object
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 $rows
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
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
namespace and then decline to actually register it file or subcat img or subcat $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 modifiable & $code
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
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Allows to change the fields on the form that will be generated $name
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
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place $output
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
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
if(!is_readable( $file)) $ext
if(!isset( $args[0])) $lang