47 return MediaWikiServices::getInstance()
48 ->getMediaHandlerFactory()->getHandler(
$type );
143 Hooks::run(
'GetMetadataVersion', [ &$version ] );
145 return implode(
';', $version );
159 if ( !is_array( $metadata ) ) {
161 MediaWiki\suppressWarnings();
163 MediaWiki\restoreWarnings();
292 if ( !
$ext || $magic->isMatchingExtension(
$ext,
$mime ) ===
false ) {
295 $extensions = $magic->getExtensionsForType(
$mime );
297 return [ strtok( $extensions,
' ' ),
$mime ];
444 $numPages = $file->pageCount();
450 for ( $i = 1; $i <= $numPages; $i++ ) {
452 if ( is_string( $curPage ) ) {
453 $document .= $curPage .
"\n";
456 if ( $document !==
'' ) {
513 foreach ( $formatted as $name =>
$value ) {
514 $tag = strtolower( $name );
516 in_array( $tag, $visibleFields ) ?
'visible' :
'collapsed',
561 if ( $msg->exists() ) {
562 $name = $msg->text();
569 wfDebug( __METHOD__ .
' Unknown metadata name: ' . $id .
"\n" );
572 $array[$visibility][] = [
608 return htmlspecialchars(
$wgLang->formatSize( $file->getSize() ) );
618 return wfMessage(
'file-info' )->sizeParams( $file->getSize() )
619 ->params(
'<span class="mime-type">' . $file->getMimeType() .
'</span>' )->parse();
630 public static function fitBoxWidth( $boxWidth, $boxHeight, $maxHeight ) {
631 $idealWidth = $boxWidth * $maxHeight / $boxHeight;
632 $roundedUp = ceil( $idealWidth );
633 if ( round( $roundedUp * $boxHeight / $boxWidth ) > $maxHeight ) {
634 return floor( $idealWidth );
674 return Status::newGood();
686 if ( file_exists( $dstPath ) ) {
687 $thumbstat = stat( $dstPath );
688 if ( $thumbstat[
'size'] == 0 ||
$retval != 0 ) {
689 $result = unlink( $dstPath );
693 sprintf(
'Removing bad %d-byte thumbnail "%s". unlink() succeeded',
694 $thumbstat[
'size'], $dstPath ) );
697 sprintf(
'Removing bad %d-byte thumbnail "%s". unlink() failed',
698 $thumbstat[
'size'], $dstPath ) );
764 # Keep error output limited (T59985)
765 $errMessage = trim( substr( $err, 0, self::MAX_ERR_LOG_SIZE ) );
768 sprintf(
'thumbnail failed on %s: error %d "%s" from "%s"',
879 $pageRangesByDimensions = [];
881 foreach ( $pagesByDimensions as $dimensions => $pageList ) {
883 $firstPage = $pageList[0];
884 $lastPage = $firstPage - 1;
886 foreach ( $pageList as $page ) {
887 if ( $page > $lastPage + 1 ) {
888 if ( $firstPage != $lastPage ) {
889 $ranges[] =
"$firstPage-$lastPage";
891 $ranges[] =
"$firstPage";
900 if ( $firstPage != $lastPage ) {
901 $ranges[] =
"$firstPage-$lastPage";
903 $ranges[] =
"$firstPage";
906 $pageRangesByDimensions[ $dimensions ] = $ranges;
909 $dimensionsString = [];
910 foreach ( $pageRangesByDimensions as $dimensions => $pageRanges ) {
911 $dimensionsString[] =
"$dimensions:" . implode(
',', $pageRanges );
914 return implode(
'/', $dimensionsString );
unserialize( $serialized)
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfHostname()
Fetch server name for use in error reporting etc.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Implements some public methods and some protected utility functions which are required by multiple ch...
static singleton()
Get an instance of this class.
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 $wgLang
namespace being checked & $result
do that in ParserLimitReportFormat instead $parser
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 incomplete not yet checked for validity & $retval
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 $image
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
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
it s the revision text itself In either if gzip is the revision text is gzipped $flags
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 & $ret
Allows to change the fields on the form that will be generated $name
if( $ext=='php'|| $ext=='php5') $mime