MediaWiki REL1_32
File.php
Go to the documentation of this file.
1<?php
9
51abstract class File implements IDBAccessObject {
52 // Bitfield values akin to the Revision deletion constants
53 const DELETED_FILE = 1;
54 const DELETED_COMMENT = 2;
55 const DELETED_USER = 4;
57
59 const RENDER_NOW = 1;
64 const RENDER_FORCE = 2;
65
66 const DELETE_SOURCE = 1;
67
68 // Audience options for File::getDescription()
69 const FOR_PUBLIC = 1;
70 const FOR_THIS_USER = 2;
71 const RAW = 3;
72
73 // Options for File::thumbName()
74 const THUMB_FULL_NAME = 1;
75
96 public $repo;
97
99 protected $title;
100
102 protected $lastError;
103
105 protected $redirected;
106
109
111 protected $fsFile;
112
114 protected $handler;
115
117 protected $url;
118
120 protected $extension;
121
123 protected $name;
124
126 protected $path;
127
129 protected $hashPath;
130
134 protected $pageCount;
135
138
140 protected $redirectTitle;
141
143 protected $canRender;
144
148 protected $isSafeFile;
149
151 protected $repoClass = FileRepo::class;
152
155
166 function __construct( $title, $repo ) {
167 // Some subclasses do not use $title, but set name/title some other way
168 if ( $title !== false ) {
169 $title = self::normalizeTitle( $title, 'exception' );
170 }
171 $this->title = $title;
172 $this->repo = $repo;
173 }
174
184 static function normalizeTitle( $title, $exception = false ) {
185 $ret = $title;
186 if ( $ret instanceof Title ) {
187 # Normalize NS_MEDIA -> NS_FILE
188 if ( $ret->getNamespace() == NS_MEDIA ) {
189 $ret = Title::makeTitleSafe( NS_FILE, $ret->getDBkey() );
190 # Sanity check the title namespace
191 } elseif ( $ret->getNamespace() !== NS_FILE ) {
192 $ret = null;
193 }
194 } else {
195 # Convert strings to Title objects
196 $ret = Title::makeTitleSafe( NS_FILE, (string)$ret );
197 }
198 if ( !$ret && $exception !== false ) {
199 throw new MWException( "`$title` is not a valid file title." );
200 }
201
202 return $ret;
203 }
204
205 function __get( $name ) {
206 $function = [ $this, 'get' . ucfirst( $name ) ];
207 if ( !is_callable( $function ) ) {
208 return null;
209 } else {
210 $this->$name = call_user_func( $function );
211
212 return $this->$name;
213 }
214 }
215
224 static function normalizeExtension( $extension ) {
225 $lower = strtolower( $extension );
226 $squish = [
227 'htm' => 'html',
228 'jpeg' => 'jpg',
229 'mpeg' => 'mpg',
230 'tiff' => 'tif',
231 'ogv' => 'ogg' ];
232 if ( isset( $squish[$lower] ) ) {
233 return $squish[$lower];
234 } elseif ( preg_match( '/^[0-9a-z]+$/', $lower ) ) {
235 return $lower;
236 } else {
237 return '';
238 }
239 }
240
249 static function checkExtensionCompatibility( File $old, $new ) {
250 $oldMime = $old->getMimeType();
251 $n = strrpos( $new, '.' );
252 $newExt = self::normalizeExtension( $n ? substr( $new, $n + 1 ) : '' );
253 $mimeMagic = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer();
254
255 return $mimeMagic->isMatchingExtension( $newExt, $oldMime );
256 }
257
263 function upgradeRow() {
264 }
265
273 public static function splitMime( $mime ) {
274 if ( strpos( $mime, '/' ) !== false ) {
275 return explode( '/', $mime, 2 );
276 } else {
277 return [ $mime, 'unknown' ];
278 }
279 }
280
288 public static function compare( File $a, File $b ) {
289 return strcmp( $a->getName(), $b->getName() );
290 }
291
297 public function getName() {
298 if ( !isset( $this->name ) ) {
299 $this->assertRepoDefined();
300 $this->name = $this->repo->getNameFromTitle( $this->title );
301 }
302
303 return $this->name;
304 }
305
311 function getExtension() {
312 if ( !isset( $this->extension ) ) {
313 $n = strrpos( $this->getName(), '.' );
314 $this->extension = self::normalizeExtension(
315 $n ? substr( $this->getName(), $n + 1 ) : '' );
316 }
317
318 return $this->extension;
319 }
320
326 public function getTitle() {
327 return $this->title;
328 }
329
335 public function getOriginalTitle() {
336 if ( $this->redirected ) {
337 return $this->getRedirectedTitle();
338 }
339
340 return $this->title;
341 }
342
348 public function getUrl() {
349 if ( !isset( $this->url ) ) {
350 $this->assertRepoDefined();
351 $ext = $this->getExtension();
352 $this->url = $this->repo->getZoneUrl( 'public', $ext ) . '/' . $this->getUrlRel();
353 }
354
355 return $this->url;
356 }
357
364 public function getDescriptionShortUrl() {
365 return null;
366 }
367
375 public function getFullUrl() {
376 return wfExpandUrl( $this->getUrl(), PROTO_RELATIVE );
377 }
378
382 public function getCanonicalUrl() {
383 return wfExpandUrl( $this->getUrl(), PROTO_CANONICAL );
384 }
385
389 function getViewURL() {
390 if ( $this->mustRender() ) {
391 if ( $this->canRender() ) {
392 return $this->createThumb( $this->getWidth() );
393 } else {
394 wfDebug( __METHOD__ . ': supposed to render ' . $this->getName() .
395 ' (' . $this->getMimeType() . "), but can't!\n" );
396
397 return $this->getUrl(); # hm... return NULL?
398 }
399 } else {
400 return $this->getUrl();
401 }
402 }
403
417 public function getPath() {
418 if ( !isset( $this->path ) ) {
419 $this->assertRepoDefined();
420 $this->path = $this->repo->getZonePath( 'public' ) . '/' . $this->getRel();
421 }
422
423 return $this->path;
424 }
425
433 public function getLocalRefPath() {
434 $this->assertRepoDefined();
435 if ( !isset( $this->fsFile ) ) {
436 $starttime = microtime( true );
437 $this->fsFile = $this->repo->getLocalReference( $this->getPath() );
438
439 $statTiming = microtime( true ) - $starttime;
440 MediaWikiServices::getInstance()->getStatsdDataFactory()->timing(
441 'media.thumbnail.generate.fetchoriginal', 1000 * $statTiming );
442
443 if ( !$this->fsFile ) {
444 $this->fsFile = false; // null => false; cache negative hits
445 }
446 }
447
448 return ( $this->fsFile )
449 ? $this->fsFile->getPath()
450 : false;
451 }
452
463 public function getWidth( $page = 1 ) {
464 return false;
465 }
466
477 public function getHeight( $page = 1 ) {
478 return false;
479 }
480
490 public function getThumbnailBucket( $desiredWidth, $page = 1 ) {
492
493 $imageWidth = $this->getWidth( $page );
494
495 if ( $imageWidth === false ) {
496 return false;
497 }
498
499 if ( $desiredWidth > $imageWidth ) {
500 return false;
501 }
502
503 if ( !$wgThumbnailBuckets ) {
504 return false;
505 }
506
507 $sortedBuckets = $wgThumbnailBuckets;
508
509 sort( $sortedBuckets );
510
511 foreach ( $sortedBuckets as $bucket ) {
512 if ( $bucket >= $imageWidth ) {
513 return false;
514 }
515
516 if ( $bucket - $wgThumbnailMinimumBucketDistance > $desiredWidth ) {
517 return $bucket;
518 }
519 }
520
521 // Image is bigger than any available bucket
522 return false;
523 }
524
532 public function getUser( $type = 'text' ) {
533 return null;
534 }
535
541 public function getLength() {
542 $handler = $this->getHandler();
543 if ( $handler ) {
544 return $handler->getLength( $this );
545 } else {
546 return 0;
547 }
548 }
549
555 public function isVectorized() {
556 $handler = $this->getHandler();
557 if ( $handler ) {
558 return $handler->isVectorized( $this );
559 } else {
560 return false;
561 }
562 }
563
575 public function getAvailableLanguages() {
576 $handler = $this->getHandler();
577 if ( $handler ) {
578 return $handler->getAvailableLanguages( $this );
579 } else {
580 return [];
581 }
582 }
583
591 public function getMatchedLanguage( $userPreferredLanguage ) {
592 $handler = $this->getHandler();
593 if ( $handler ) {
595 $userPreferredLanguage,
597 );
598 }
599
600 return null;
601 }
602
610 public function getDefaultRenderLanguage() {
611 $handler = $this->getHandler();
612 if ( $handler ) {
613 return $handler->getDefaultRenderLanguage( $this );
614 } else {
615 return null;
616 }
617 }
618
630 $handler = $this->getHandler();
631 if ( !$handler ) {
632 // We cannot handle image whatsoever, thus
633 // one would not expect it to be animated
634 // so true.
635 return true;
636 } else {
637 if ( $this->allowInlineDisplay()
638 && $handler->isAnimatedImage( $this )
639 && !$handler->canAnimateThumbnail( $this )
640 ) {
641 // Image is animated, but thumbnail isn't.
642 // This is unexpected to the user.
643 return false;
644 } else {
645 // Image is not animated, so one would
646 // not expect thumb to be
647 return true;
648 }
649 }
650 }
651
658 public function getMetadata() {
659 return false;
660 }
661
668 public function getCommonMetaArray() {
669 $handler = $this->getHandler();
670
671 if ( !$handler ) {
672 return false;
673 }
674
675 return $handler->getCommonMetaArray( $this );
676 }
677
686 public function convertMetadataVersion( $metadata, $version ) {
687 $handler = $this->getHandler();
688 if ( !is_array( $metadata ) ) {
689 // Just to make the return type consistent
690 $metadata = unserialize( $metadata );
691 }
692 if ( $handler ) {
693 return $handler->convertMetadataVersion( $metadata, $version );
694 } else {
695 return $metadata;
696 }
697 }
698
705 public function getBitDepth() {
706 return 0;
707 }
708
715 public function getSize() {
716 return false;
717 }
718
726 function getMimeType() {
727 return 'unknown/unknown';
728 }
729
737 function getMediaType() {
738 return MEDIATYPE_UNKNOWN;
739 }
740
753 function canRender() {
754 if ( !isset( $this->canRender ) ) {
755 $this->canRender = $this->getHandler() && $this->handler->canRender( $this ) && $this->exists();
756 }
757
758 return $this->canRender;
759 }
760
765 protected function getCanRender() {
766 return $this->canRender();
767 }
768
779 function mustRender() {
780 return $this->getHandler() && $this->handler->mustRender( $this );
781 }
782
789 return $this->canRender();
790 }
791
805 function isSafeFile() {
806 if ( !isset( $this->isSafeFile ) ) {
807 $this->isSafeFile = $this->getIsSafeFileUncached();
808 }
809
810 return $this->isSafeFile;
811 }
812
818 protected function getIsSafeFile() {
819 return $this->isSafeFile();
820 }
821
827 protected function getIsSafeFileUncached() {
829
830 if ( $this->allowInlineDisplay() ) {
831 return true;
832 }
833 if ( $this->isTrustedFile() ) {
834 return true;
835 }
836
837 $type = $this->getMediaType();
838 $mime = $this->getMimeType();
839 # wfDebug( "LocalFile::isSafeFile: type= $type, mime= $mime\n" );
840
841 if ( !$type || $type === MEDIATYPE_UNKNOWN ) {
842 return false; # unknown type, not trusted
843 }
844 if ( in_array( $type, $wgTrustedMediaFormats ) ) {
845 return true;
846 }
847
848 if ( $mime === "unknown/unknown" ) {
849 return false; # unknown type, not trusted
850 }
851 if ( in_array( $mime, $wgTrustedMediaFormats ) ) {
852 return true;
853 }
854
855 return false;
856 }
857
871 function isTrustedFile() {
872 # this could be implemented to check a flag in the database,
873 # look for signatures, etc
874 return false;
875 }
876
886 public function load( $flags = 0 ) {
887 }
888
896 public function exists() {
897 return $this->getPath() && $this->repo->fileExists( $this->path );
898 }
899
906 public function isVisible() {
907 return $this->exists();
908 }
909
914 if ( !isset( $this->transformScript ) ) {
915 $this->transformScript = false;
916 if ( $this->repo ) {
917 $script = $this->repo->getThumbScriptUrl();
918 if ( $script ) {
919 $this->transformScript = wfAppendQuery( $script, [ 'f' => $this->getName() ] );
920 }
921 }
922 }
923
925 }
926
935 $hp =& $handlerParams;
936 $page = $hp['page'] ?? false;
937 $width = $this->getWidth( $page );
938 if ( !$width ) {
939 return $this->iconThumb();
940 }
941 $hp['width'] = $width;
942 // be sure to ignore any height specification as well (T64258)
943 unset( $hp['height'] );
944
945 return $this->transform( $hp );
946 }
947
957 public function thumbName( $params, $flags = 0 ) {
958 $name = ( $this->repo && !( $flags & self::THUMB_FULL_NAME ) )
959 ? $this->repo->nameForThumb( $this->getName() )
960 : $this->getName();
961
962 return $this->generateThumbName( $name, $params );
963 }
964
972 public function generateThumbName( $name, $params ) {
973 if ( !$this->getHandler() ) {
974 return null;
975 }
976 $extension = $this->getExtension();
977 list( $thumbExt, ) = $this->getHandler()->getThumbType(
978 $extension, $this->getMimeType(), $params );
979 $thumbName = $this->getHandler()->makeParamString( $params );
980
981 if ( $this->repo->supportsSha1URLs() ) {
982 $thumbName .= '-' . $this->getSha1() . '.' . $thumbExt;
983 } else {
984 $thumbName .= '-' . $name;
985
986 if ( $thumbExt != $extension ) {
987 $thumbName .= ".$thumbExt";
988 }
989 }
990
991 return $thumbName;
992 }
993
1011 public function createThumb( $width, $height = -1 ) {
1012 $params = [ 'width' => $width ];
1013 if ( $height != -1 ) {
1014 $params['height'] = $height;
1015 }
1016 $thumb = $this->transform( $params );
1017 if ( !$thumb || $thumb->isError() ) {
1018 return '';
1019 }
1020
1021 return $thumb->getUrl();
1022 }
1023
1033 protected function transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags ) {
1034 global $wgIgnoreImageErrors;
1035
1036 $handler = $this->getHandler();
1037 if ( $handler && $wgIgnoreImageErrors && !( $flags & self::RENDER_NOW ) ) {
1038 return $handler->getTransform( $this, $thumbPath, $thumbUrl, $params );
1039 } else {
1040 return new MediaTransformError( 'thumbnail_error',
1041 $params['width'], 0, wfMessage( 'thumbnail-dest-create' ) );
1042 }
1043 }
1044
1053 function transform( $params, $flags = 0 ) {
1054 global $wgThumbnailEpoch;
1055
1056 do {
1057 if ( !$this->canRender() ) {
1058 $thumb = $this->iconThumb();
1059 break; // not a bitmap or renderable image, don't try
1060 }
1061
1062 // Get the descriptionUrl to embed it as comment into the thumbnail. T21791.
1063 $descriptionUrl = $this->getDescriptionUrl();
1064 if ( $descriptionUrl ) {
1065 $params['descriptionUrl'] = wfExpandUrl( $descriptionUrl, PROTO_CANONICAL );
1066 }
1067
1068 $handler = $this->getHandler();
1069 $script = $this->getTransformScript();
1070 if ( $script && !( $flags & self::RENDER_NOW ) ) {
1071 // Use a script to transform on client request, if possible
1072 $thumb = $handler->getScriptedTransform( $this, $script, $params );
1073 if ( $thumb ) {
1074 break;
1075 }
1076 }
1077
1078 $normalisedParams = $params;
1079 $handler->normaliseParams( $this, $normalisedParams );
1080
1081 $thumbName = $this->thumbName( $normalisedParams );
1082 $thumbUrl = $this->getThumbUrl( $thumbName );
1083 $thumbPath = $this->getThumbPath( $thumbName ); // final thumb path
1084
1085 if ( $this->repo ) {
1086 // Defer rendering if a 404 handler is set up...
1087 if ( $this->repo->canTransformVia404() && !( $flags & self::RENDER_NOW ) ) {
1088 // XXX: Pass in the storage path even though we are not rendering anything
1089 // and the path is supposed to be an FS path. This is due to getScalerType()
1090 // getting called on the path and clobbering $thumb->getUrl() if it's false.
1091 $thumb = $handler->getTransform( $this, $thumbPath, $thumbUrl, $params );
1092 break;
1093 }
1094 // Check if an up-to-date thumbnail already exists...
1095 wfDebug( __METHOD__ . ": Doing stat for $thumbPath\n" );
1096 if ( !( $flags & self::RENDER_FORCE ) && $this->repo->fileExists( $thumbPath ) ) {
1097 $timestamp = $this->repo->getFileTimestamp( $thumbPath );
1098 if ( $timestamp !== false && $timestamp >= $wgThumbnailEpoch ) {
1099 // XXX: Pass in the storage path even though we are not rendering anything
1100 // and the path is supposed to be an FS path. This is due to getScalerType()
1101 // getting called on the path and clobbering $thumb->getUrl() if it's false.
1102 $thumb = $handler->getTransform( $this, $thumbPath, $thumbUrl, $params );
1103 $thumb->setStoragePath( $thumbPath );
1104 break;
1105 }
1106 } elseif ( $flags & self::RENDER_FORCE ) {
1107 wfDebug( __METHOD__ . " forcing rendering per flag File::RENDER_FORCE\n" );
1108 }
1109
1110 // If the backend is ready-only, don't keep generating thumbnails
1111 // only to return transformation errors, just return the error now.
1112 if ( $this->repo->getReadOnlyReason() !== false ) {
1113 $thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags );
1114 break;
1115 }
1116 }
1117
1118 $tmpFile = $this->makeTransformTmpFile( $thumbPath );
1119
1120 if ( !$tmpFile ) {
1121 $thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags );
1122 } else {
1123 $thumb = $this->generateAndSaveThumb( $tmpFile, $params, $flags );
1124 }
1125 } while ( false );
1126
1127 return is_object( $thumb ) ? $thumb : false;
1128 }
1129
1137 public function generateAndSaveThumb( $tmpFile, $transformParams, $flags ) {
1138 global $wgIgnoreImageErrors;
1139
1140 $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
1141
1142 $handler = $this->getHandler();
1143
1144 $normalisedParams = $transformParams;
1145 $handler->normaliseParams( $this, $normalisedParams );
1146
1147 $thumbName = $this->thumbName( $normalisedParams );
1148 $thumbUrl = $this->getThumbUrl( $thumbName );
1149 $thumbPath = $this->getThumbPath( $thumbName ); // final thumb path
1150
1151 $tmpThumbPath = $tmpFile->getPath();
1152
1153 if ( $handler->supportsBucketing() ) {
1154 $this->generateBucketsIfNeeded( $normalisedParams, $flags );
1155 }
1156
1157 $starttime = microtime( true );
1158
1159 // Actually render the thumbnail...
1160 $thumb = $handler->doTransform( $this, $tmpThumbPath, $thumbUrl, $transformParams );
1161 $tmpFile->bind( $thumb ); // keep alive with $thumb
1162
1163 $statTiming = microtime( true ) - $starttime;
1164 $stats->timing( 'media.thumbnail.generate.transform', 1000 * $statTiming );
1165
1166 if ( !$thumb ) { // bad params?
1167 $thumb = false;
1168 } elseif ( $thumb->isError() ) { // transform error
1170 $this->lastError = $thumb->toText();
1171 // Ignore errors if requested
1172 if ( $wgIgnoreImageErrors && !( $flags & self::RENDER_NOW ) ) {
1173 $thumb = $handler->getTransform( $this, $tmpThumbPath, $thumbUrl, $transformParams );
1174 }
1175 } elseif ( $this->repo && $thumb->hasFile() && !$thumb->fileIsSource() ) {
1176 // Copy the thumbnail from the file system into storage...
1177
1178 $starttime = microtime( true );
1179
1180 $disposition = $this->getThumbDisposition( $thumbName );
1181 $status = $this->repo->quickImport( $tmpThumbPath, $thumbPath, $disposition );
1182 if ( $status->isOK() ) {
1183 $thumb->setStoragePath( $thumbPath );
1184 } else {
1185 $thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $transformParams, $flags );
1186 }
1187
1188 $statTiming = microtime( true ) - $starttime;
1189 $stats->timing( 'media.thumbnail.generate.store', 1000 * $statTiming );
1190
1191 // Give extensions a chance to do something with this thumbnail...
1192 Hooks::run( 'FileTransformed', [ $this, $thumb, $tmpThumbPath, $thumbPath ] );
1193 }
1194
1195 return $thumb;
1196 }
1197
1204 protected function generateBucketsIfNeeded( $params, $flags = 0 ) {
1205 if ( !$this->repo
1206 || !isset( $params['physicalWidth'] )
1207 || !isset( $params['physicalHeight'] )
1208 ) {
1209 return false;
1210 }
1211
1212 $bucket = $this->getThumbnailBucket( $params['physicalWidth'] );
1213
1214 if ( !$bucket || $bucket == $params['physicalWidth'] ) {
1215 return false;
1216 }
1217
1218 $bucketPath = $this->getBucketThumbPath( $bucket );
1219
1220 if ( $this->repo->fileExists( $bucketPath ) ) {
1221 return false;
1222 }
1223
1224 $starttime = microtime( true );
1225
1226 $params['physicalWidth'] = $bucket;
1227 $params['width'] = $bucket;
1228
1229 $params = $this->getHandler()->sanitizeParamsForBucketing( $params );
1230
1231 $tmpFile = $this->makeTransformTmpFile( $bucketPath );
1232
1233 if ( !$tmpFile ) {
1234 return false;
1235 }
1236
1237 $thumb = $this->generateAndSaveThumb( $tmpFile, $params, $flags );
1238
1239 $buckettime = microtime( true ) - $starttime;
1240
1241 if ( !$thumb || $thumb->isError() ) {
1242 return false;
1243 }
1244
1245 $this->tmpBucketedThumbCache[$bucket] = $tmpFile->getPath();
1246 // For the caching to work, we need to make the tmp file survive as long as
1247 // this object exists
1248 $tmpFile->bind( $this );
1249
1250 MediaWikiServices::getInstance()->getStatsdDataFactory()->timing(
1251 'media.thumbnail.generate.bucket', 1000 * $buckettime );
1252
1253 return true;
1254 }
1255
1261 public function getThumbnailSource( $params ) {
1262 if ( $this->repo
1263 && $this->getHandler()->supportsBucketing()
1264 && isset( $params['physicalWidth'] )
1265 && $bucket = $this->getThumbnailBucket( $params['physicalWidth'] )
1266 ) {
1267 if ( $this->getWidth() != 0 ) {
1268 $bucketHeight = round( $this->getHeight() * ( $bucket / $this->getWidth() ) );
1269 } else {
1270 $bucketHeight = 0;
1271 }
1272
1273 // Try to avoid reading from storage if the file was generated by this script
1274 if ( isset( $this->tmpBucketedThumbCache[$bucket] ) ) {
1275 $tmpPath = $this->tmpBucketedThumbCache[$bucket];
1276
1277 if ( file_exists( $tmpPath ) ) {
1278 return [
1279 'path' => $tmpPath,
1280 'width' => $bucket,
1281 'height' => $bucketHeight
1282 ];
1283 }
1284 }
1285
1286 $bucketPath = $this->getBucketThumbPath( $bucket );
1287
1288 if ( $this->repo->fileExists( $bucketPath ) ) {
1289 $fsFile = $this->repo->getLocalReference( $bucketPath );
1290
1291 if ( $fsFile ) {
1292 return [
1293 'path' => $fsFile->getPath(),
1294 'width' => $bucket,
1295 'height' => $bucketHeight
1296 ];
1297 }
1298 }
1299 }
1300
1301 // Thumbnailing a very large file could result in network saturation if
1302 // everyone does it at once.
1303 if ( $this->getSize() >= 1e7 ) { // 10MB
1304 $work = new PoolCounterWorkViaCallback( 'GetLocalFileCopy', sha1( $this->getName() ),
1305 [
1306 'doWork' => function () {
1307 return $this->getLocalRefPath();
1308 }
1309 ]
1310 );
1311 $srcPath = $work->execute();
1312 } else {
1313 $srcPath = $this->getLocalRefPath();
1314 }
1315
1316 // Original file
1317 return [
1318 'path' => $srcPath,
1319 'width' => $this->getWidth(),
1320 'height' => $this->getHeight()
1321 ];
1322 }
1323
1329 protected function getBucketThumbPath( $bucket ) {
1330 $thumbName = $this->getBucketThumbName( $bucket );
1331 return $this->getThumbPath( $thumbName );
1332 }
1333
1339 protected function getBucketThumbName( $bucket ) {
1340 return $this->thumbName( [ 'physicalWidth' => $bucket ] );
1341 }
1342
1348 protected function makeTransformTmpFile( $thumbPath ) {
1349 $thumbExt = FileBackend::extensionFromPath( $thumbPath );
1350 return TempFSFile::factory( 'transform_', $thumbExt, wfTempDir() );
1351 }
1352
1358 function getThumbDisposition( $thumbName, $dispositionType = 'inline' ) {
1359 $fileName = $this->name; // file name to suggest
1360 $thumbExt = FileBackend::extensionFromPath( $thumbName );
1361 if ( $thumbExt != '' && $thumbExt !== $this->getExtension() ) {
1362 $fileName .= ".$thumbExt";
1363 }
1364
1365 return FileBackend::makeContentDisposition( $dispositionType, $fileName );
1366 }
1367
1374 function migrateThumbFile( $thumbName ) {
1375 }
1376
1383 function getHandler() {
1384 if ( !isset( $this->handler ) ) {
1385 $this->handler = MediaHandler::getHandler( $this->getMimeType() );
1386 }
1387
1388 return $this->handler;
1389 }
1390
1396 function iconThumb() {
1397 global $wgResourceBasePath, $IP;
1398 $assetsPath = "$wgResourceBasePath/resources/assets/file-type-icons/";
1399 $assetsDirectory = "$IP/resources/assets/file-type-icons/";
1400
1401 $try = [ 'fileicon-' . $this->getExtension() . '.png', 'fileicon.png' ];
1402 foreach ( $try as $icon ) {
1403 if ( file_exists( $assetsDirectory . $icon ) ) { // always FS
1404 $params = [ 'width' => 120, 'height' => 120 ];
1405
1406 return new ThumbnailImage( $this, $assetsPath . $icon, false, $params );
1407 }
1408 }
1409
1410 return null;
1411 }
1412
1418 function getLastError() {
1419 return $this->lastError;
1420 }
1421
1428 function getThumbnails() {
1429 return [];
1430 }
1431
1439 function purgeCache( $options = [] ) {
1440 }
1441
1447 function purgeDescription() {
1448 $title = $this->getTitle();
1449 if ( $title ) {
1451 $title->purgeSquid();
1452 }
1453 }
1454
1459 function purgeEverything() {
1460 // Delete thumbnails and refresh file metadata cache
1461 $this->purgeCache();
1462 $this->purgeDescription();
1463
1464 // Purge cache of all pages using this file
1465 $title = $this->getTitle();
1466 if ( $title ) {
1467 DeferredUpdates::addUpdate(
1468 new HTMLCacheUpdate( $title, 'imagelinks', 'file-purge' )
1469 );
1470 }
1471 }
1472
1484 function getHistory( $limit = null, $start = null, $end = null, $inc = true ) {
1485 return [];
1486 }
1487
1497 public function nextHistoryLine() {
1498 return false;
1499 }
1500
1507 public function resetHistory() {
1508 }
1509
1517 function getHashPath() {
1518 if ( !isset( $this->hashPath ) ) {
1519 $this->assertRepoDefined();
1520 $this->hashPath = $this->repo->getHashPath( $this->getName() );
1521 }
1522
1523 return $this->hashPath;
1524 }
1525
1532 function getRel() {
1533 return $this->getHashPath() . $this->getName();
1534 }
1535
1543 function getArchiveRel( $suffix = false ) {
1544 $path = 'archive/' . $this->getHashPath();
1545 if ( $suffix === false ) {
1546 $path = substr( $path, 0, -1 );
1547 } else {
1548 $path .= $suffix;
1549 }
1550
1551 return $path;
1552 }
1553
1561 function getThumbRel( $suffix = false ) {
1562 $path = $this->getRel();
1563 if ( $suffix !== false ) {
1564 $path .= '/' . $suffix;
1565 }
1566
1567 return $path;
1568 }
1569
1576 function getUrlRel() {
1577 return $this->getHashPath() . rawurlencode( $this->getName() );
1578 }
1579
1588 function getArchiveThumbRel( $archiveName, $suffix = false ) {
1589 $path = 'archive/' . $this->getHashPath() . $archiveName . "/";
1590 if ( $suffix === false ) {
1591 $path = substr( $path, 0, -1 );
1592 } else {
1593 $path .= $suffix;
1594 }
1595
1596 return $path;
1597 }
1598
1605 function getArchivePath( $suffix = false ) {
1606 $this->assertRepoDefined();
1607
1608 return $this->repo->getZonePath( 'public' ) . '/' . $this->getArchiveRel( $suffix );
1609 }
1610
1618 function getArchiveThumbPath( $archiveName, $suffix = false ) {
1619 $this->assertRepoDefined();
1620
1621 return $this->repo->getZonePath( 'thumb' ) . '/' .
1622 $this->getArchiveThumbRel( $archiveName, $suffix );
1623 }
1624
1631 function getThumbPath( $suffix = false ) {
1632 $this->assertRepoDefined();
1633
1634 return $this->repo->getZonePath( 'thumb' ) . '/' . $this->getThumbRel( $suffix );
1635 }
1636
1643 function getTranscodedPath( $suffix = false ) {
1644 $this->assertRepoDefined();
1645
1646 return $this->repo->getZonePath( 'transcoded' ) . '/' . $this->getThumbRel( $suffix );
1647 }
1648
1655 function getArchiveUrl( $suffix = false ) {
1656 $this->assertRepoDefined();
1657 $ext = $this->getExtension();
1658 $path = $this->repo->getZoneUrl( 'public', $ext ) . '/archive/' . $this->getHashPath();
1659 if ( $suffix === false ) {
1660 $path = substr( $path, 0, -1 );
1661 } else {
1662 $path .= rawurlencode( $suffix );
1663 }
1664
1665 return $path;
1666 }
1667
1675 function getArchiveThumbUrl( $archiveName, $suffix = false ) {
1676 $this->assertRepoDefined();
1677 $ext = $this->getExtension();
1678 $path = $this->repo->getZoneUrl( 'thumb', $ext ) . '/archive/' .
1679 $this->getHashPath() . rawurlencode( $archiveName ) . "/";
1680 if ( $suffix === false ) {
1681 $path = substr( $path, 0, -1 );
1682 } else {
1683 $path .= rawurlencode( $suffix );
1684 }
1685
1686 return $path;
1687 }
1688
1696 function getZoneUrl( $zone, $suffix = false ) {
1697 $this->assertRepoDefined();
1698 $ext = $this->getExtension();
1699 $path = $this->repo->getZoneUrl( $zone, $ext ) . '/' . $this->getUrlRel();
1700 if ( $suffix !== false ) {
1701 $path .= '/' . rawurlencode( $suffix );
1702 }
1703
1704 return $path;
1705 }
1706
1713 function getThumbUrl( $suffix = false ) {
1714 return $this->getZoneUrl( 'thumb', $suffix );
1715 }
1716
1723 function getTranscodedUrl( $suffix = false ) {
1724 return $this->getZoneUrl( 'transcoded', $suffix );
1725 }
1726
1733 function getVirtualUrl( $suffix = false ) {
1734 $this->assertRepoDefined();
1735 $path = $this->repo->getVirtualUrl() . '/public/' . $this->getUrlRel();
1736 if ( $suffix !== false ) {
1737 $path .= '/' . rawurlencode( $suffix );
1738 }
1739
1740 return $path;
1741 }
1742
1749 function getArchiveVirtualUrl( $suffix = false ) {
1750 $this->assertRepoDefined();
1751 $path = $this->repo->getVirtualUrl() . '/public/archive/' . $this->getHashPath();
1752 if ( $suffix === false ) {
1753 $path = substr( $path, 0, -1 );
1754 } else {
1755 $path .= rawurlencode( $suffix );
1756 }
1757
1758 return $path;
1759 }
1760
1767 function getThumbVirtualUrl( $suffix = false ) {
1768 $this->assertRepoDefined();
1769 $path = $this->repo->getVirtualUrl() . '/thumb/' . $this->getUrlRel();
1770 if ( $suffix !== false ) {
1771 $path .= '/' . rawurlencode( $suffix );
1772 }
1773
1774 return $path;
1775 }
1776
1780 function isHashed() {
1781 $this->assertRepoDefined();
1782
1783 return (bool)$this->repo->getHashLevels();
1784 }
1785
1789 function readOnlyError() {
1790 throw new MWException( static::class . ': write operations are not supported' );
1791 }
1792
1808 function recordUpload( $oldver, $desc, $license = '', $copyStatus = '', $source = '',
1809 $watch = false, $timestamp = false, User $user = null
1810 ) {
1811 $this->readOnlyError();
1812 }
1813
1835 function publish( $src, $flags = 0, array $options = [] ) {
1836 $this->readOnlyError();
1837 }
1838
1843 function formatMetadata( $context = false ) {
1844 if ( !$this->getHandler() ) {
1845 return false;
1846 }
1847
1848 return $this->getHandler()->formatMetadata( $this, $context );
1849 }
1850
1856 function isLocal() {
1857 return $this->repo && $this->repo->isLocal();
1858 }
1859
1865 function getRepoName() {
1866 return $this->repo ? $this->repo->getName() : 'unknown';
1867 }
1868
1874 function getRepo() {
1875 return $this->repo;
1876 }
1877
1884 function isOld() {
1885 return false;
1886 }
1887
1895 function isDeleted( $field ) {
1896 return false;
1897 }
1898
1904 function getVisibility() {
1905 return 0;
1906 }
1907
1913 function wasDeleted() {
1914 $title = $this->getTitle();
1915
1916 return $title && $title->isDeletedQuick();
1917 }
1918
1931 function move( $target ) {
1932 $this->readOnlyError();
1933 }
1934
1950 function delete( $reason, $suppress = false, $user = null ) {
1951 $this->readOnlyError();
1952 }
1953
1968 function restore( $versions = [], $unsuppress = false ) {
1969 $this->readOnlyError();
1970 }
1971
1979 function isMultipage() {
1980 return $this->getHandler() && $this->handler->isMultiPage( $this );
1981 }
1982
1989 function pageCount() {
1990 if ( !isset( $this->pageCount ) ) {
1991 if ( $this->getHandler() && $this->handler->isMultiPage( $this ) ) {
1992 $this->pageCount = $this->handler->pageCount( $this );
1993 } else {
1994 $this->pageCount = false;
1995 }
1996 }
1997
1998 return $this->pageCount;
1999 }
2000
2010 static function scaleHeight( $srcWidth, $srcHeight, $dstWidth ) {
2011 // Exact integer multiply followed by division
2012 if ( $srcWidth == 0 ) {
2013 return 0;
2014 } else {
2015 return (int)round( $srcHeight * $dstWidth / $srcWidth );
2016 }
2017 }
2018
2029 function getImageSize( $filePath ) {
2030 if ( !$this->getHandler() ) {
2031 return false;
2032 }
2033
2034 return $this->getHandler()->getImageSize( $this, $filePath );
2035 }
2036
2044 if ( $this->repo ) {
2045 return $this->repo->getDescriptionUrl( $this->getName() );
2046 } else {
2047 return false;
2048 }
2049 }
2050
2057 function getDescriptionText( Language $lang = null ) {
2058 global $wgLang;
2059
2060 if ( !$this->repo || !$this->repo->fetchDescription ) {
2061 return false;
2062 }
2063
2064 $lang = $lang ?? $wgLang;
2065
2066 $renderUrl = $this->repo->getDescriptionRenderUrl( $this->getName(), $lang->getCode() );
2067 if ( $renderUrl ) {
2068 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
2069 $key = $this->repo->getLocalCacheKey(
2070 'RemoteFileDescription',
2071 $lang->getCode(),
2072 md5( $this->getName() )
2073 );
2074 $fname = __METHOD__;
2075
2076 return $cache->getWithSetCallback(
2077 $key,
2078 $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
2079 function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl, $fname ) {
2080 wfDebug( "Fetching shared description from $renderUrl\n" );
2081 $res = Http::get( $renderUrl, [], $fname );
2082 if ( !$res ) {
2083 $ttl = WANObjectCache::TTL_UNCACHEABLE;
2084 }
2085
2086 return $res;
2087 }
2088 );
2089 }
2090
2091 return false;
2092 }
2093
2106 function getDescription( $audience = self::FOR_PUBLIC, User $user = null ) {
2107 return null;
2108 }
2109
2115 function getTimestamp() {
2116 $this->assertRepoDefined();
2117
2118 return $this->repo->getFileTimestamp( $this->getPath() );
2119 }
2120
2128 public function getDescriptionTouched() {
2129 return false;
2130 }
2131
2137 function getSha1() {
2138 $this->assertRepoDefined();
2139
2140 return $this->repo->getFileSha1( $this->getPath() );
2141 }
2142
2148 function getStorageKey() {
2149 $hash = $this->getSha1();
2150 if ( !$hash ) {
2151 return false;
2152 }
2153 $ext = $this->getExtension();
2154 $dotExt = $ext === '' ? '' : ".$ext";
2155
2156 return $hash . $dotExt;
2157 }
2158
2167 function userCan( $field, User $user = null ) {
2168 return true;
2169 }
2170
2176 $handler = $this->getHandler();
2177 if ( $handler ) {
2178 $metadata = $this->getMetadata();
2179
2180 if ( is_string( $metadata ) ) {
2181 $metadata = Wikimedia\quietCall( 'unserialize', $metadata );
2182 }
2183
2184 if ( !is_array( $metadata ) ) {
2185 $metadata = [];
2186 }
2187
2188 return $handler->getContentHeaders( $metadata );
2189 }
2190
2191 return [];
2192 }
2193
2197 function getLongDesc() {
2198 $handler = $this->getHandler();
2199 if ( $handler ) {
2200 return $handler->getLongDesc( $this );
2201 } else {
2202 return MediaHandler::getGeneralLongDesc( $this );
2203 }
2204 }
2205
2209 function getShortDesc() {
2210 $handler = $this->getHandler();
2211 if ( $handler ) {
2212 return $handler->getShortDesc( $this );
2213 } else {
2214 return MediaHandler::getGeneralShortDesc( $this );
2215 }
2216 }
2217
2222 $handler = $this->getHandler();
2223 if ( $handler ) {
2224 return $handler->getDimensionsString( $this );
2225 } else {
2226 return '';
2227 }
2228 }
2229
2233 function getRedirected() {
2234 return $this->redirected;
2235 }
2236
2241 if ( $this->redirected ) {
2242 if ( !$this->redirectTitle ) {
2243 $this->redirectTitle = Title::makeTitle( NS_FILE, $this->redirected );
2244 }
2245
2246 return $this->redirectTitle;
2247 }
2248
2249 return null;
2250 }
2251
2256 function redirectedFrom( $from ) {
2257 $this->redirected = $from;
2258 }
2259
2263 function isMissing() {
2264 return false;
2265 }
2266
2271 public function isCacheable() {
2272 return true;
2273 }
2274
2279 protected function assertRepoDefined() {
2280 if ( !( $this->repo instanceof $this->repoClass ) ) {
2281 throw new MWException( "A {$this->repoClass} object is not set for this File.\n" );
2282 }
2283 }
2284
2289 protected function assertTitleDefined() {
2290 if ( !( $this->title instanceof Title ) ) {
2291 throw new MWException( "A Title object is not set for this File.\n" );
2292 }
2293 }
2294
2299 public function isExpensiveToThumbnail() {
2300 $handler = $this->getHandler();
2301 return $handler ? $handler->isExpensiveToThumbnail( $this ) : false;
2302 }
2303
2309 public function isTransformedLocally() {
2310 return true;
2311 }
2312}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
unserialize( $serialized)
$wgIgnoreImageErrors
If set, inline scaled images will still produce "<img>" tags ready for output instead of showing an e...
$wgThumbnailBuckets
When defined, is an array of image widths used as buckets for thumbnail generation.
$wgThumbnailMinimumBucketDistance
When using thumbnail buckets as defined above, this sets the minimum distance to the bucket above the...
$wgResourceBasePath
The default 'remoteBasePath' value for instances of ResourceLoaderFileModule.
$wgThumbnailEpoch
If rendered thumbnail files are older than this timestamp, they will be rerendered on demand as if th...
$wgTrustedMediaFormats
list of trusted media-types and MIME types.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfTempDir()
Tries to get the system directory for temporary files.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
Definition Setup.php:121
$wgLang
Definition Setup.php:910
$IP
Definition WebStart.php:41
$starttime
Definition api.php:37
Class representing a non-directory file on the file system.
Definition FSFile.php:29
getPath()
Returns the file system path.
Definition FSFile.php:50
static extensionFromPath( $path, $case='lowercase')
Get the final extension from a storage or FS path.
static makeContentDisposition( $type, $filename='')
Build a Content-Disposition header value per RFC 6266.
Base class for file repositories.
Definition FileRepo.php:39
Implements some public methods and some protected utility functions which are required by multiple ch...
Definition File.php:51
getStorageKey()
Get the deletion archive key, "<sha1>.<ext>".
Definition File.php:2148
string $url
The URL corresponding to one of the four basic zones.
Definition File.php:117
getVisibility()
Return the deletion bitfield STUB.
Definition File.php:1904
isVectorized()
Return true if the file is vectorized.
Definition File.php:555
recordUpload( $oldver, $desc, $license='', $copyStatus='', $source='', $watch=false, $timestamp=false, User $user=null)
Record a file upload in the upload log and the image table STUB Overridden by LocalFile.
Definition File.php:1808
restore( $versions=[], $unsuppress=false)
Restore all or specified deleted revisions to the given file.
Definition File.php:1968
isExpensiveToThumbnail()
True if creating thumbnails from the file is large or otherwise resource-intensive.
Definition File.php:2299
isLocal()
Returns true if the file comes from the local file repository.
Definition File.php:1856
getThumbRel( $suffix=false)
Get the path, relative to the thumbnail zone root, of the thumbnail directory or a particular file if...
Definition File.php:1561
getLastError()
Get last thumbnailing error.
Definition File.php:1418
getShortDesc()
Definition File.php:2209
generateAndSaveThumb( $tmpFile, $transformParams, $flags)
Generates a thumbnail according to the given parameters and saves it to storage.
Definition File.php:1137
MediaHandler $handler
Definition File.php:114
purgeDescription()
Purge the file description page, but don't go after pages using the file.
Definition File.php:1447
__construct( $title, $repo)
Call this constructor from child classes.
Definition File.php:166
getIsSafeFileUncached()
Uncached accessor.
Definition File.php:827
getArchivePath( $suffix=false)
Get the path of the archived file.
Definition File.php:1605
getBucketThumbName( $bucket)
Returns the name of the thumb for a given bucket.
Definition File.php:1339
FSFile bool $fsFile
False if undefined.
Definition File.php:111
const RENDER_NOW
Force rendering in the current process.
Definition File.php:59
getPath()
Return the storage path to the file.
Definition File.php:417
getThumbPath( $suffix=false)
Get the path of the thumbnail directory, or a particular file if $suffix is specified.
Definition File.php:1631
getThumbVirtualUrl( $suffix=false)
Get the virtual URL for a thumbnail file or directory.
Definition File.php:1767
getIsSafeFile()
Accessor for __get()
Definition File.php:818
redirectedFrom( $from)
Definition File.php:2256
getDescriptionTouched()
Returns the timestamp (in TS_MW format) of the last change of the description page.
Definition File.php:2128
transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags)
Return either a MediaTransformError or placeholder thumbnail (if $wgIgnoreImageErrors)
Definition File.php:1033
array $tmpBucketedThumbCache
Cache of tmp filepaths pointing to generated bucket thumbnails, keyed by width.
Definition File.php:154
getMimeType()
Returns the MIME type of the file.
Definition File.php:726
getSize()
Return the size of the image file, in bytes Overridden by LocalFile, UnregisteredLocalFile STUB.
Definition File.php:715
string $extension
File extension.
Definition File.php:120
pageCount()
Returns the number of pages of a multipage document, or false for documents which aren't multipage do...
Definition File.php:1989
getMediaType()
Return the type of the media in the file.
Definition File.php:737
string $redirected
Main part of the title, with underscores (Title::getDBkey)
Definition File.php:105
getTranscodedUrl( $suffix=false)
Get the URL of the transcoded directory, or a particular file if $suffix is specified.
Definition File.php:1723
bool $isSafeFile
Whether this media file is in a format that is unlikely to contain viruses or malicious content.
Definition File.php:148
getRel()
Get the path of the file relative to the public zone root.
Definition File.php:1532
getLength()
Get the duration of a media file in seconds.
Definition File.php:541
static normalizeTitle( $title, $exception=false)
Given a string or Title object return either a valid Title object with namespace NS_FILE or null.
Definition File.php:184
getTimestamp()
Get the 14-character timestamp of the file upload.
Definition File.php:2115
assertRepoDefined()
Assert that $this->repo is set to a valid FileRepo instance.
Definition File.php:2279
getName()
Return the name of this file.
Definition File.php:297
resetHistory()
Reset the history pointer to the first element of the history.
Definition File.php:1507
canAnimateThumbIfAppropriate()
Will the thumbnail be animated if one would expect it to be.
Definition File.php:629
getWidth( $page=1)
Return the width of the image.
Definition File.php:463
getLocalRefPath()
Get an FS copy or original of this file and return the path.
Definition File.php:433
exists()
Returns true if file exists in the repository.
Definition File.php:896
const DELETE_SOURCE
Definition File.php:66
getMatchedLanguage( $userPreferredLanguage)
Get the language code from the available languages for this file that matches the language requested ...
Definition File.php:591
getThumbUrl( $suffix=false)
Get the URL of the thumbnail directory, or a particular file if $suffix is specified.
Definition File.php:1713
Title $redirectedTitle
Definition File.php:108
allowInlineDisplay()
Alias for canRender()
Definition File.php:788
string false $pageCount
Number of pages of a multipage document, or false for documents which aren't multipage documents.
Definition File.php:134
mustRender()
Return true if the file is of a type that can't be directly rendered by typical browsers and needs to...
Definition File.php:779
getVirtualUrl( $suffix=false)
Get the public zone virtual URL for a current version source file.
Definition File.php:1733
isTrustedFile()
Returns true if the file is flagged as trusted.
Definition File.php:871
getHistory( $limit=null, $start=null, $end=null, $inc=true)
Return a fragment of the history of file.
Definition File.php:1484
isCacheable()
Check if this file object is small and can be cached.
Definition File.php:2271
getTransformScript()
Definition File.php:913
isMissing()
Definition File.php:2263
isVisible()
Returns true if file exists in the repository and can be included in a page.
Definition File.php:906
iconThumb()
Get a ThumbnailImage representing a file type icon.
Definition File.php:1396
getRepo()
Returns the repository.
Definition File.php:1874
getZoneUrl( $zone, $suffix=false)
Get the URL of the zone directory, or a particular file if $suffix is specified.
Definition File.php:1696
getDimensionsString()
Definition File.php:2221
const DELETED_COMMENT
Definition File.php:54
upgradeRow()
Upgrade the database row if there is one Called by ImagePage STUB.
Definition File.php:263
convertMetadataVersion( $metadata, $version)
get versioned metadata
Definition File.php:686
const FOR_PUBLIC
Definition File.php:69
getCanRender()
Accessor for __get()
Definition File.php:765
getDescriptionText(Language $lang=null)
Get the HTML text of the description page, if available.
Definition File.php:2057
getArchiveVirtualUrl( $suffix=false)
Get the public zone virtual URL for an archived version source file.
Definition File.php:1749
assertTitleDefined()
Assert that $this->title is set to a Title.
Definition File.php:2289
getArchiveThumbPath( $archiveName, $suffix=false)
Get the path of an archived file's thumbs, or a particular thumb if $suffix is specified.
Definition File.php:1618
getHeight( $page=1)
Return the height of the image.
Definition File.php:477
getThumbnailSource( $params)
Returns the most appropriate source image for the thumbnail, given a target thumbnail size.
Definition File.php:1261
getArchiveThumbRel( $archiveName, $suffix=false)
Get the path, relative to the thumbnail zone root, for an archived file's thumbs directory or a speci...
Definition File.php:1588
getUser( $type='text')
Returns ID or name of user who uploaded the file STUB.
Definition File.php:532
makeTransformTmpFile( $thumbPath)
Creates a temp FS file with the same extension and the thumbnail.
Definition File.php:1348
getBitDepth()
Return the bit depth of the file Overridden by LocalFile STUB.
Definition File.php:705
publish( $src, $flags=0, array $options=[])
Move or copy a file to its public location.
Definition File.php:1835
isOld()
Returns true if the image is an old version STUB.
Definition File.php:1884
getContentHeaders()
Definition File.php:2175
getTitle()
Return the associated title object.
Definition File.php:326
getDescriptionShortUrl()
Get short description URL for a files based on the page ID.
Definition File.php:364
const DELETED_RESTRICTED
Definition File.php:56
canRender()
Checks if the output of transform() for this file is likely to be valid.
Definition File.php:753
getAvailableLanguages()
Gives a (possibly empty) list of languages to render the file in.
Definition File.php:575
getCommonMetaArray()
Like getMetadata but returns a handler independent array of common values.
Definition File.php:668
getOriginalTitle()
Return the title used to find this file.
Definition File.php:335
getRepoName()
Returns the name of the repository.
Definition File.php:1865
getDefaultRenderLanguage()
In files that support multiple language, what is the default language to use if none specified.
Definition File.php:610
readOnlyError()
Definition File.php:1789
migrateThumbFile( $thumbName)
Hook into transform() to allow migration of thumbnail files STUB Overridden by LocalFile.
Definition File.php:1374
static compare(File $a, File $b)
Callback for usort() to do file sorts by name.
Definition File.php:288
getCanonicalUrl()
Definition File.php:382
isMultipage()
Returns 'true' if this file is a type which supports multiple pages, e.g.
Definition File.php:1979
isSafeFile()
Determines if this media file is in a format that is unlikely to contain viruses or malicious content...
Definition File.php:805
getThumbnails()
Get all thumbnail names previously generated for this file STUB Overridden by LocalFile.
Definition File.php:1428
createThumb( $width, $height=-1)
Create a thumbnail of the image having the specified width/height.
Definition File.php:1011
string $name
The name of a file from its title object.
Definition File.php:123
const RAW
Definition File.php:71
getTranscodedPath( $suffix=false)
Get the path of the transcoded directory, or a particular file if $suffix is specified.
Definition File.php:1643
load( $flags=0)
Load any lazy-loaded file object fields from source.
Definition File.php:886
getExtension()
Get the file extension, e.g.
Definition File.php:311
isHashed()
Definition File.php:1780
FileRepo LocalRepo ForeignAPIRepo bool $repo
Some member variables can be lazy-initialised using __get().
Definition File.php:96
transform( $params, $flags=0)
Transform a media file.
Definition File.php:1053
getImageSize( $filePath)
Get an image size array like that returned by getImageSize(), or false if it can't be determined.
Definition File.php:2029
nextHistoryLine()
Return the history of this file, line by line.
Definition File.php:1497
purgeEverything()
Purge metadata and all affected pages when the file is created, deleted, or majorly updated.
Definition File.php:1459
const DELETED_FILE
Definition File.php:53
getRedirected()
Definition File.php:2233
string $path
The storage path corresponding to one of the zones.
Definition File.php:126
static normalizeExtension( $extension)
Normalize a file extension to the common form, making it lowercase and checking some synonyms,...
Definition File.php:224
static splitMime( $mime)
Split an internet media type into its two components; if not a two-part name, set the minor type to '...
Definition File.php:273
getUrl()
Return the URL of the file.
Definition File.php:348
Title string bool $title
Definition File.php:99
wasDeleted()
Was this file ever deleted from the wiki?
Definition File.php:1913
string $transformScript
URL of transformscript (for example thumb.php)
Definition File.php:137
string $repoClass
Required Repository class type.
Definition File.php:151
thumbName( $params, $flags=0)
Return the file name of a thumbnail with the specified parameters.
Definition File.php:957
const DELETED_USER
Definition File.php:55
getArchiveUrl( $suffix=false)
Get the URL of the archive directory, or a particular file if $suffix is specified.
Definition File.php:1655
getSha1()
Get the SHA-1 base 36 hash of the file.
Definition File.php:2137
getViewURL()
Definition File.php:389
formatMetadata( $context=false)
Definition File.php:1843
userCan( $field, User $user=null)
Determine if the current user is allowed to view a particular field of this file, if it's marked as d...
Definition File.php:2167
const THUMB_FULL_NAME
Definition File.php:74
Title $redirectTitle
Definition File.php:140
isTransformedLocally()
Whether the thumbnails created on the same server as this code is running.
Definition File.php:2309
getLongDesc()
Definition File.php:2197
getHandler()
Get a MediaHandler instance for this file.
Definition File.php:1383
getDescriptionUrl()
Get the URL of the image description page.
Definition File.php:2043
string $hashPath
Relative path including trailing slash.
Definition File.php:129
getBucketThumbPath( $bucket)
Returns the repo path of the thumb for a given bucket.
Definition File.php:1329
purgeCache( $options=[])
Purge shared caches such as thumbnails and DB data caching STUB Overridden by LocalFile.
Definition File.php:1439
getThumbnailBucket( $desiredWidth, $page=1)
Return the smallest bucket from $wgThumbnailBuckets which is at least $wgThumbnailMinimumBucketDistan...
Definition File.php:490
getUnscaledThumb( $handlerParams=[])
Get a ThumbnailImage which is the same size as the source.
Definition File.php:934
getArchiveRel( $suffix=false)
Get the path of an archived file relative to the public zone root.
Definition File.php:1543
getUrlRel()
Get urlencoded path of the file relative to the public zone root.
Definition File.php:1576
getThumbDisposition( $thumbName, $dispositionType='inline')
Definition File.php:1358
const FOR_THIS_USER
Definition File.php:70
move( $target)
Move file to the new title.
Definition File.php:1931
generateBucketsIfNeeded( $params, $flags=0)
Generates chained bucketed thumbnails if needed.
Definition File.php:1204
getRedirectedTitle()
Definition File.php:2240
__get( $name)
Definition File.php:205
static scaleHeight( $srcWidth, $srcHeight, $dstWidth)
Calculate the height of a thumbnail using the source and destination width.
Definition File.php:2010
isDeleted( $field)
Is this file a "deleted" file in a private archive? STUB.
Definition File.php:1895
getArchiveThumbUrl( $archiveName, $suffix=false)
Get the URL of the archived file's thumbs, or a particular thumb if $suffix is specified.
Definition File.php:1675
getDescription( $audience=self::FOR_PUBLIC, User $user=null)
Get description of file revision STUB.
Definition File.php:2106
getMetadata()
Get handler-specific metadata Overridden by LocalFile, UnregisteredLocalFile STUB.
Definition File.php:658
generateThumbName( $name, $params)
Generate a thumbnail file name from a name and specified parameters.
Definition File.php:972
bool $canRender
Whether the output of transform() for this file is likely to be valid.
Definition File.php:143
getFullUrl()
Return a fully-qualified URL to the file.
Definition File.php:375
const RENDER_FORCE
Force rendering even if thumbnail already exist and using RENDER_NOW I.e.
Definition File.php:64
static checkExtensionCompatibility(File $old, $new)
Checks if file extensions are compatible.
Definition File.php:249
getHashPath()
Get the filename hash component of the directory including trailing slash, e.g.
Definition File.php:1517
string $lastError
Text of last error.
Definition File.php:102
A foreign repository with a remote MediaWiki with an API thingy.
Class to invalidate the HTML cache of all the pages linking to a given title.
static get( $url, $options=[], $caller=__METHOD__)
Simple wrapper for Http::request( 'GET' )
Definition Http.php:98
Internationalisation code.
Definition Language.php:35
A repository that stores files in the local filesystem and registers them in the wiki's own database.
Definition LocalRepo.php:36
MediaWiki exception.
Base media handler class.
normaliseParams( $image, &$params)
Changes the parameter array as necessary, ready for transformation.
canAnimateThumbnail( $file)
If the material is animated, we can animate the thumbnail.
supportsBucketing()
Returns whether or not this handler supports the chained generation of thumbnails according to bucket...
static getGeneralLongDesc( $file)
Used instead of getLongDesc if there is no handler registered for file.
getDefaultRenderLanguage(File $file)
On file types that support renderings in multiple languages, which language is used by default if uns...
getLength( $file)
If its an audio file, return the length of the file.
getTransform( $image, $dstPath, $dstUrl, $params)
Get a MediaTransformOutput object representing the transformed output.
getDimensionsString( $file)
Shown in file history box on image description page.
static getHandler( $type)
Get a MediaHandler for a given MIME type from the instance cache.
getCommonMetaArray(File $file)
Get an array of standard (FormatMetadata type) metadata values.
doTransform( $image, $dstPath, $dstUrl, $params, $flags=0)
Get a MediaTransformOutput object representing the transformed output.
isAnimatedImage( $file)
The material is an image, and is animated.
isVectorized( $file)
The material is vectorized and thus scaling is lossless.
convertMetadataVersion( $metadata, $version=1)
Convert metadata version.
static getGeneralShortDesc( $file)
Used instead of getShortDesc if there is no handler registered for file.
getLongDesc( $file)
Long description.
getScriptedTransform( $image, $script, $params)
Get a MediaTransformOutput object representing an alternate of the transformed output which will call...
isExpensiveToThumbnail( $file)
True if creating thumbnails from the file is large or otherwise resource-intensive.
getAvailableLanguages(File $file)
Get list of languages file can be viewed in.
getShortDesc( $file)
Short description.
getContentHeaders( $metadata)
Get useful response headers for GET/HEAD requests for a file with the given metadata.
getMatchedLanguage( $userPreferredLanguage, array $availableLanguages)
When overridden in a descendant class, returns a language code most suiting.
Basic media transform error class.
MediaWikiServices is the service locator for the application scope of MediaWiki.
Convenience class for dealing with PoolCounters using callbacks.
execute( $skipcache=false)
Get the result of the work (whatever it is), or the result of the error() function.
static factory( $prefix, $extension='', $tmpDirectory=null)
Make a new temporary file on the file system.
Media transform output for images.
Represents a title within MediaWiki.
Definition Title.php:39
purgeSquid()
Purge all applicable CDN URLs.
Definition Title.php:3982
isDeletedQuick()
Is there a version of this page in the deletion archive?
Definition Title.php:3540
invalidateCache( $purgeTime=null)
Updates page_touched for this page; called from LinksUpdate.php.
Definition Title.php:4844
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:47
$res
Definition database.txt:21
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
Definition deferred.txt:11
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
const PROTO_CANONICAL
Definition Defines.php:223
const NS_FILE
Definition Defines.php:70
const NS_MEDIA
Definition Defines.php:52
const PROTO_RELATIVE
Definition Defines.php:221
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. 'ContentSecurityPolicyDefaultSource':Modify the allowed CSP load sources. This affects all directives except for the script directive. If you want to add a script source, see ContentSecurityPolicyScriptSource hook. & $defaultSrc:Array of Content-Security-Policy allowed sources $policyConfig:Current configuration for the Content-Security-Policy header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header 'ContentSecurityPolicyDirectives':Modify the content security policy directives. Use this only if ContentSecurityPolicyDefaultSource and ContentSecurityPolicyScriptSource do not meet your needs. & $directives:Array of CSP directives $policyConfig:Current configuration for the CSP header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header 'ContentSecurityPolicyScriptSource':Modify the allowed CSP script sources. Note that you also have to use ContentSecurityPolicyDefaultSource if you want non-script sources to be loaded from whatever you add. & $scriptSrc:Array of CSP directives $policyConfig:Current configuration for the CSP header $mode:ContentSecurityPolicy::REPORT_ONLY_MODE or ContentSecurityPolicy::FULL_MODE depending on type of header '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
Definition hooks.txt:1305
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
Definition hooks.txt:2050
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
Definition hooks.txt:2885
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 set to a MediaTransformOutput the error message to be returned in an array you should do so by altering $wgNamespaceProtection and $wgNamespaceContentModels outside the handler
Definition hooks.txt:960
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
Definition hooks.txt:2054
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 "&lt;div ...>$1&lt;/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
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 or wrap services the preferred way to define a new service is the $wgServiceWiringFiles array change it to the message you want to define you are encouraged to submit patches to MediaWiki s core to add new MIME types to mime types $mimeMagic
Definition hooks.txt:2357
and how to run hooks for an and one after Each event has a name
Definition hooks.txt:12
see documentation in includes Linker php for Linker::makeImageLink & $handlerParams
Definition hooks.txt:1839
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
Definition hooks.txt:247
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
Definition injection.txt:37
Interface for database access objects.
$cache
Definition mcc.php:33
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))
const MEDIATYPE_UNKNOWN
Definition defines.php:26
$source
title
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
Definition postgres.txt:36
if( $ext=='php'|| $ext=='php5') $mime
Definition router.php:59
if(!is_readable( $file)) $ext
Definition router.php:55
$params
if(!isset( $args[0])) $lang