47 return MediaWikiServices::getInstance()
48 ->getMediaHandlerFactory()->getHandler(
$type );
143 Hooks::run(
'GetMetadataVersion', [ &$version ] );
145 return implode(
';', $version );
159 if ( !is_array( $metadata ) ) {
161 Wikimedia\suppressWarnings();
163 Wikimedia\restoreWarnings();
291 $magic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
292 if ( !
$ext || $magic->isMatchingExtension(
$ext,
$mime ) ===
false ) {
295 $extensions = $magic->getExtensionsForType(
$mime );
297 return [ strtok( $extensions,
' ' ),
$mime ];
434 $numPages = $file->pageCount();
440 for ( $i = 1; $i <= $numPages; $i++ ) {
442 if ( is_string( $curPage ) ) {
443 $document .= $curPage .
"\n";
446 if ( $document !==
'' ) {
503 foreach ( $formatted as $name =>
$value ) {
504 $tag = strtolower( $name );
506 in_array( $tag, $visibleFields ) ?
'visible' :
'collapsed',
551 if ( $msg->exists() ) {
552 $name = $msg->text();
559 wfDebug( __METHOD__ .
' Unknown metadata name: ' . $id .
"\n" );
562 $array[$visibility][] = [
598 return htmlspecialchars(
$wgLang->formatSize( $file->getSize() ) );
608 return wfMessage(
'file-info' )->sizeParams( $file->getSize() )
609 ->params(
'<span class="mime-type">' . $file->getMimeType() .
'</span>' )->parse();
620 public static function fitBoxWidth( $boxWidth, $boxHeight, $maxHeight ) {
621 $idealWidth = $boxWidth * $maxHeight / $boxHeight;
622 $roundedUp = ceil( $idealWidth );
623 if ( round( $roundedUp * $boxHeight / $boxWidth ) > $maxHeight ) {
624 return floor( $idealWidth );
664 return Status::newGood();
676 if ( file_exists( $dstPath ) ) {
677 $thumbstat = stat( $dstPath );
678 if ( $thumbstat[
'size'] == 0 ||
$retval != 0 ) {
679 $result = unlink( $dstPath );
683 sprintf(
'Removing bad %d-byte thumbnail "%s". unlink() succeeded',
684 $thumbstat[
'size'], $dstPath ) );
687 sprintf(
'Removing bad %d-byte thumbnail "%s". unlink() failed',
688 $thumbstat[
'size'], $dstPath ) );
754 # Keep error output limited (T59985)
755 $errMessage = trim( substr( $err, 0, self::MAX_ERR_LOG_SIZE ) );
758 sprintf(
'thumbnail failed on %s: error %d "%s" from "%s"',
882 $pageRangesByDimensions = [];
884 foreach ( $pagesByDimensions as $dimensions => $pageList ) {
886 $firstPage = $pageList[0];
887 $lastPage = $firstPage - 1;
889 foreach ( $pageList as $page ) {
890 if ( $page > $lastPage + 1 ) {
891 if ( $firstPage != $lastPage ) {
892 $ranges[] =
"$firstPage-$lastPage";
894 $ranges[] =
"$firstPage";
903 if ( $firstPage != $lastPage ) {
904 $ranges[] =
"$firstPage-$lastPage";
906 $ranges[] =
"$firstPage";
909 $pageRangesByDimensions[ $dimensions ] = $ranges;
912 $dimensionsString = [];
913 foreach ( $pageRangesByDimensions as $dimensions => $pageRanges ) {
914 $dimensionsString[] =
"$dimensions:" . implode(
',', $pageRanges );
917 return implode(
'/', $dimensionsString );
927 return [
'X-Content-Dimensions' =>
'' ];
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,...
Implements some public methods and some protected utility functions which are required by multiple ch...
namespace being checked & $result
see documentation in includes Linker php for Linker::makeImageLink or false for current used if you return false $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
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
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 use $formDescriptor instead 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
Allows to change the fields on the form that will be generated $name
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( $ext=='php'|| $ext=='php5') $mime
if(!is_readable( $file)) $ext