MediaWiki REL1_32
BitmapHandler.php
Go to the documentation of this file.
1<?php
30
39 protected function getScalerType( $dstPath, $checkDstPath = true ) {
41
42 if ( !$dstPath && $checkDstPath ) {
43 # No output path available, client side scaling only
44 $scaler = 'client';
45 } elseif ( !$wgUseImageResize ) {
46 $scaler = 'client';
47 } elseif ( $wgUseImageMagick ) {
48 $scaler = 'im';
49 } elseif ( $wgCustomConvertCommand ) {
50 $scaler = 'custom';
51 } elseif ( function_exists( 'imagecreatetruecolor' ) ) {
52 $scaler = 'gd';
53 } elseif ( class_exists( 'Imagick' ) ) {
54 $scaler = 'imext';
55 } else {
56 $scaler = 'client';
57 }
58
59 return $scaler;
60 }
61
62 public function makeParamString( $params ) {
63 $res = parent::makeParamString( $params );
64 if ( isset( $params['interlace'] ) && $params['interlace'] ) {
65 return "interlaced-{$res}";
66 } else {
67 return $res;
68 }
69 }
70
71 public function parseParamString( $str ) {
72 $remainder = preg_replace( '/^interlaced-/', '', $str );
73 $params = parent::parseParamString( $remainder );
74 if ( $params === false ) {
75 return false;
76 }
77 $params['interlace'] = $str !== $remainder;
78 return $params;
79 }
80
81 public function validateParam( $name, $value ) {
82 if ( $name === 'interlace' ) {
83 return $value === false || $value === true;
84 } else {
85 return parent::validateParam( $name, $value );
86 }
87 }
88
96 if ( !parent::normaliseParams( $image, $params ) ) {
97 return false;
98 }
99 $mimeType = $image->getMimeType();
100 $interlace = isset( $params['interlace'] ) && $params['interlace']
101 && isset( $wgMaxInterlacingAreas[$mimeType] )
102 && $this->getImageArea( $image ) <= $wgMaxInterlacingAreas[$mimeType];
103 $params['interlace'] = $interlace;
104 return true;
105 }
106
113 protected function imageMagickSubsampling( $pixelFormat ) {
114 switch ( $pixelFormat ) {
115 case 'yuv444':
116 return [ '1x1', '1x1', '1x1' ];
117 case 'yuv422':
118 return [ '2x1', '1x1', '1x1' ];
119 case 'yuv420':
120 return [ '2x2', '1x1', '1x1' ];
121 default:
122 throw new MWException( 'Invalid pixel format for JPEG output' );
123 }
124 }
125
134 protected function transformImageMagick( $image, $params ) {
135 # use ImageMagick
139
140 $quality = [];
141 $sharpen = [];
142 $scene = false;
143 $animation_pre = [];
144 $animation_post = [];
145 $decoderHint = [];
146 $subsampling = [];
147
148 if ( $params['mimeType'] == 'image/jpeg' ) {
149 $qualityVal = isset( $params['quality'] ) ? (string)$params['quality'] : null;
150 $quality = [ '-quality', $qualityVal ?: (string)$wgJpegQuality ]; // 80% by default
151 if ( $params['interlace'] ) {
152 $animation_post = [ '-interlace', 'JPEG' ];
153 }
154 # Sharpening, see T8193
155 if ( ( $params['physicalWidth'] + $params['physicalHeight'] )
156 / ( $params['srcWidth'] + $params['srcHeight'] )
158 ) {
159 $sharpen = [ '-sharpen', $wgSharpenParameter ];
160 }
161 if ( version_compare( $this->getMagickVersion(), "6.5.6" ) >= 0 ) {
162 // JPEG decoder hint to reduce memory, available since IM 6.5.6-2
163 $decoderHint = [ '-define', "jpeg:size={$params['physicalDimensions']}" ];
164 }
165 if ( $wgJpegPixelFormat ) {
166 $factors = $this->imageMagickSubsampling( $wgJpegPixelFormat );
167 $subsampling = [ '-sampling-factor', implode( ',', $factors ) ];
168 }
169 } elseif ( $params['mimeType'] == 'image/png' ) {
170 $quality = [ '-quality', '95' ]; // zlib 9, adaptive filtering
171 if ( $params['interlace'] ) {
172 $animation_post = [ '-interlace', 'PNG' ];
173 }
174 } elseif ( $params['mimeType'] == 'image/webp' ) {
175 $quality = [ '-quality', '95' ]; // zlib 9, adaptive filtering
176 } elseif ( $params['mimeType'] == 'image/gif' ) {
177 if ( $this->getImageArea( $image ) > $wgMaxAnimatedGifArea ) {
178 // Extract initial frame only; we're so big it'll
179 // be a total drag. :P
180 $scene = 0;
181 } elseif ( $this->isAnimatedImage( $image ) ) {
182 // Coalesce is needed to scale animated GIFs properly (T3017).
183 $animation_pre = [ '-coalesce' ];
184 // We optimize the output, but -optimize is broken,
185 // use optimizeTransparency instead (T13822)
186 if ( version_compare( $this->getMagickVersion(), "6.3.5" ) >= 0 ) {
187 $animation_post = [ '-fuzz', '5%', '-layers', 'optimizeTransparency' ];
188 }
189 }
190 if ( $params['interlace'] && version_compare( $this->getMagickVersion(), "6.3.4" ) >= 0
191 && !$this->isAnimatedImage( $image ) ) { // interlacing animated GIFs is a bad idea
192 $animation_post[] = '-interlace';
193 $animation_post[] = 'GIF';
194 }
195 } elseif ( $params['mimeType'] == 'image/x-xcf' ) {
196 // Before merging layers, we need to set the background
197 // to be transparent to preserve alpha, as -layers merge
198 // merges all layers on to a canvas filled with the
199 // background colour. After merging we reset the background
200 // to be white for the default background colour setting
201 // in the PNG image (which is used in old IE)
202 $animation_pre = [
203 '-background', 'transparent',
204 '-layers', 'merge',
205 '-background', 'white',
206 ];
207 Wikimedia\suppressWarnings();
208 $xcfMeta = unserialize( $image->getMetadata() );
209 Wikimedia\restoreWarnings();
210 if ( $xcfMeta
211 && isset( $xcfMeta['colorType'] )
212 && $xcfMeta['colorType'] === 'greyscale-alpha'
213 && version_compare( $this->getMagickVersion(), "6.8.9-3" ) < 0
214 ) {
215 // T68323 - Greyscale images not rendered properly.
216 // So only take the "red" channel.
217 $channelOnly = [ '-channel', 'R', '-separate' ];
218 $animation_pre = array_merge( $animation_pre, $channelOnly );
219 }
220 }
221
222 // Use one thread only, to avoid deadlock bugs on OOM
223 $env = [ 'OMP_NUM_THREADS' => 1 ];
224 if ( strval( $wgImageMagickTempDir ) !== '' ) {
225 $env['MAGICK_TMPDIR'] = $wgImageMagickTempDir;
226 }
227
228 $rotation = isset( $params['disableRotation'] ) ? 0 : $this->getRotation( $image );
229 list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation );
230
231 $cmd = wfEscapeShellArg( ...array_merge(
233 $quality,
234 // Specify white background color, will be used for transparent images
235 // in Internet Explorer/Windows instead of default black.
236 [ '-background', 'white' ],
237 $decoderHint,
238 [ $this->escapeMagickInput( $params['srcPath'], $scene ) ],
239 $animation_pre,
240 // For the -thumbnail option a "!" is needed to force exact size,
241 // or ImageMagick may decide your ratio is wrong and slice off
242 // a pixel.
243 [ '-thumbnail', "{$width}x{$height}!" ],
244 // Add the source url as a comment to the thumb, but don't add the flag if there's no comment
245 ( $params['comment'] !== ''
246 ? [ '-set', 'comment', $this->escapeMagickProperty( $params['comment'] ) ]
247 : [] ),
248 // T108616: Avoid exposure of local file path
249 [ '+set', 'Thumb::URI' ],
250 [ '-depth', 8 ],
251 $sharpen,
252 [ '-rotate', "-$rotation" ],
253 $subsampling,
254 $animation_post,
255 [ $this->escapeMagickOutput( $params['dstPath'] ) ] ) );
256
257 wfDebug( __METHOD__ . ": running ImageMagick: $cmd\n" );
258 $retval = 0;
259 $err = wfShellExecWithStderr( $cmd, $retval, $env );
260
261 if ( $retval !== 0 ) {
262 $this->logErrorForExternalProcess( $retval, $err, $cmd );
263
264 return $this->getMediaTransformError( $params, "$err\nError code: $retval" );
265 }
266
267 return false; # No error
268 }
269
278 protected function transformImageMagickExt( $image, $params ) {
281
282 try {
283 $im = new Imagick();
284 $im->readImage( $params['srcPath'] );
285
286 if ( $params['mimeType'] == 'image/jpeg' ) {
287 // Sharpening, see T8193
288 if ( ( $params['physicalWidth'] + $params['physicalHeight'] )
289 / ( $params['srcWidth'] + $params['srcHeight'] )
291 ) {
292 // Hack, since $wgSharpenParameter is written specifically for the command line convert
293 list( $radius, $sigma ) = explode( 'x', $wgSharpenParameter );
294 $im->sharpenImage( $radius, $sigma );
295 }
296 $qualityVal = isset( $params['quality'] ) ? (string)$params['quality'] : null;
297 $im->setCompressionQuality( $qualityVal ?: $wgJpegQuality );
298 if ( $params['interlace'] ) {
299 $im->setInterlaceScheme( Imagick::INTERLACE_JPEG );
300 }
301 if ( $wgJpegPixelFormat ) {
302 $factors = $this->imageMagickSubsampling( $wgJpegPixelFormat );
303 $im->setSamplingFactors( $factors );
304 }
305 } elseif ( $params['mimeType'] == 'image/png' ) {
306 $im->setCompressionQuality( 95 );
307 if ( $params['interlace'] ) {
308 $im->setInterlaceScheme( Imagick::INTERLACE_PNG );
309 }
310 } elseif ( $params['mimeType'] == 'image/gif' ) {
311 if ( $this->getImageArea( $image ) > $wgMaxAnimatedGifArea ) {
312 // Extract initial frame only; we're so big it'll
313 // be a total drag. :P
314 $im->setImageScene( 0 );
315 } elseif ( $this->isAnimatedImage( $image ) ) {
316 // Coalesce is needed to scale animated GIFs properly (T3017).
317 $im = $im->coalesceImages();
318 }
319 // GIF interlacing is only available since 6.3.4
320 $v = Imagick::getVersion();
321 preg_match( '/ImageMagick ([0-9]+\.[0-9]+\.[0-9]+)/', $v['versionString'], $v );
322
323 if ( $params['interlace'] && version_compare( $v[1], '6.3.4' ) >= 0 ) {
324 $im->setInterlaceScheme( Imagick::INTERLACE_GIF );
325 }
326 }
327
328 $rotation = isset( $params['disableRotation'] ) ? 0 : $this->getRotation( $image );
329 list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation );
330
331 $im->setImageBackgroundColor( new ImagickPixel( 'white' ) );
332
333 // Call Imagick::thumbnailImage on each frame
334 foreach ( $im as $i => $frame ) {
335 if ( !$frame->thumbnailImage( $width, $height, /* fit */ false ) ) {
336 return $this->getMediaTransformError( $params, "Error scaling frame $i" );
337 }
338 }
339 $im->setImageDepth( 8 );
340
341 if ( $rotation ) {
342 if ( !$im->rotateImage( new ImagickPixel( 'white' ), 360 - $rotation ) ) {
343 return $this->getMediaTransformError( $params, "Error rotating $rotation degrees" );
344 }
345 }
346
347 if ( $this->isAnimatedImage( $image ) ) {
348 wfDebug( __METHOD__ . ": Writing animated thumbnail\n" );
349 // This is broken somehow... can't find out how to fix it
350 $result = $im->writeImages( $params['dstPath'], true );
351 } else {
352 $result = $im->writeImage( $params['dstPath'] );
353 }
354 if ( !$result ) {
355 return $this->getMediaTransformError( $params,
356 "Unable to write thumbnail to {$params['dstPath']}" );
357 }
358 } catch ( ImagickException $e ) {
359 return $this->getMediaTransformError( $params, $e->getMessage() );
360 }
361
362 return false;
363 }
364
373 protected function transformCustom( $image, $params ) {
374 # Use a custom convert command
376
377 # Variables: %s %d %w %h
378 $src = wfEscapeShellArg( $params['srcPath'] );
379 $dst = wfEscapeShellArg( $params['dstPath'] );
381 $cmd = str_replace( '%s', $src, str_replace( '%d', $dst, $cmd ) ); # Filenames
382 $cmd = str_replace( '%h', wfEscapeShellArg( $params['physicalHeight'] ),
383 str_replace( '%w', wfEscapeShellArg( $params['physicalWidth'] ), $cmd ) ); # Size
384 wfDebug( __METHOD__ . ": Running custom convert command $cmd\n" );
385 $retval = 0;
386 $err = wfShellExecWithStderr( $cmd, $retval );
387
388 if ( $retval !== 0 ) {
389 $this->logErrorForExternalProcess( $retval, $err, $cmd );
390
391 return $this->getMediaTransformError( $params, $err );
392 }
393
394 return false; # No error
395 }
396
405 protected function transformGd( $image, $params ) {
406 # Use PHP's builtin GD library functions.
407 # First find out what kind of file this is, and select the correct
408 # input routine for this.
409
410 $typemap = [
411 'image/gif' => [ 'imagecreatefromgif', 'palette', false, 'imagegif' ],
412 'image/jpeg' => [ 'imagecreatefromjpeg', 'truecolor', true,
413 [ __CLASS__, 'imageJpegWrapper' ] ],
414 'image/png' => [ 'imagecreatefrompng', 'bits', false, 'imagepng' ],
415 'image/vnd.wap.wbmp' => [ 'imagecreatefromwbmp', 'palette', false, 'imagewbmp' ],
416 'image/xbm' => [ 'imagecreatefromxbm', 'palette', false, 'imagexbm' ],
417 ];
418
419 if ( !isset( $typemap[$params['mimeType']] ) ) {
420 $err = 'Image type not supported';
421 wfDebug( "$err\n" );
422 $errMsg = wfMessage( 'thumbnail_image-type' )->text();
423
424 return $this->getMediaTransformError( $params, $errMsg );
425 }
426 list( $loader, $colorStyle, $useQuality, $saveType ) = $typemap[$params['mimeType']];
427
428 if ( !function_exists( $loader ) ) {
429 $err = "Incomplete GD library configuration: missing function $loader";
430 wfDebug( "$err\n" );
431 $errMsg = wfMessage( 'thumbnail_gd-library', $loader )->text();
432
433 return $this->getMediaTransformError( $params, $errMsg );
434 }
435
436 if ( !file_exists( $params['srcPath'] ) ) {
437 $err = "File seems to be missing: {$params['srcPath']}";
438 wfDebug( "$err\n" );
439 $errMsg = wfMessage( 'thumbnail_image-missing', $params['srcPath'] )->text();
440
441 return $this->getMediaTransformError( $params, $errMsg );
442 }
443
444 if ( filesize( $params['srcPath'] ) === 0 ) {
445 $err = "Image file size seems to be zero.";
446 wfDebug( "$err\n" );
447 $errMsg = wfMessage( 'thumbnail_image-size-zero', $params['srcPath'] )->text();
448
449 return $this->getMediaTransformError( $params, $errMsg );
450 }
451
452 $src_image = $loader( $params['srcPath'] );
453
454 $rotation = function_exists( 'imagerotate' ) && !isset( $params['disableRotation'] ) ?
455 $this->getRotation( $image ) :
456 0;
457 list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation );
458 $dst_image = imagecreatetruecolor( $width, $height );
459
460 // Initialise the destination image to transparent instead of
461 // the default solid black, to support PNG and GIF transparency nicely
462 $background = imagecolorallocate( $dst_image, 0, 0, 0 );
463 imagecolortransparent( $dst_image, $background );
464 imagealphablending( $dst_image, false );
465
466 if ( $colorStyle == 'palette' ) {
467 // Don't resample for paletted GIF images.
468 // It may just uglify them, and completely breaks transparency.
469 imagecopyresized( $dst_image, $src_image,
470 0, 0, 0, 0,
471 $width, $height,
472 imagesx( $src_image ), imagesy( $src_image ) );
473 } else {
474 imagecopyresampled( $dst_image, $src_image,
475 0, 0, 0, 0,
476 $width, $height,
477 imagesx( $src_image ), imagesy( $src_image ) );
478 }
479
480 if ( $rotation % 360 != 0 && $rotation % 90 == 0 ) {
481 $rot_image = imagerotate( $dst_image, $rotation, 0 );
482 imagedestroy( $dst_image );
483 $dst_image = $rot_image;
484 }
485
486 imagesavealpha( $dst_image, true );
487
488 $funcParams = [ $dst_image, $params['dstPath'] ];
489 if ( $useQuality && isset( $params['quality'] ) ) {
490 $funcParams[] = $params['quality'];
491 }
492 $saveType( ...$funcParams );
493
494 imagedestroy( $dst_image );
495 imagedestroy( $src_image );
496
497 return false; # No error
498 }
499
508 static function imageJpegWrapper( $dst_image, $thumbPath, $quality = null ) {
509 global $wgJpegQuality;
510
511 if ( $quality === null ) {
512 $quality = $wgJpegQuality;
513 }
514
515 imageinterlace( $dst_image );
516 imagejpeg( $dst_image, $thumbPath, $quality );
517 }
518
524 public function canRotate() {
525 $scaler = $this->getScalerType( null, false );
526 switch ( $scaler ) {
527 case 'im':
528 # ImageMagick supports autorotation
529 return true;
530 case 'imext':
531 # Imagick::rotateImage
532 return true;
533 case 'gd':
534 # GD's imagerotate function is used to rotate images, but not
535 # all precompiled PHP versions have that function
536 return function_exists( 'imagerotate' );
537 default:
538 # Other scalers don't support rotation
539 return false;
540 }
541 }
542
547 public function autoRotateEnabled() {
549
550 if ( $wgEnableAutoRotation === null ) {
551 // Only enable auto-rotation when we actually can
552 return $this->canRotate();
553 }
554
556 }
557
565 public function rotate( $file, $params ) {
567
568 $rotation = ( $params['rotation'] + $this->getRotation( $file ) ) % 360;
569 $scene = false;
570
571 $scaler = $this->getScalerType( null, false );
572 switch ( $scaler ) {
573 case 'im':
575 wfEscapeShellArg( $this->escapeMagickInput( $params['srcPath'], $scene ) ) .
576 " -rotate " . wfEscapeShellArg( "-$rotation" ) . " " .
577 wfEscapeShellArg( $this->escapeMagickOutput( $params['dstPath'] ) );
578 wfDebug( __METHOD__ . ": running ImageMagick: $cmd\n" );
579 $retval = 0;
580 $err = wfShellExecWithStderr( $cmd, $retval );
581 if ( $retval !== 0 ) {
582 $this->logErrorForExternalProcess( $retval, $err, $cmd );
583
584 return new MediaTransformError( 'thumbnail_error', 0, 0, $err );
585 }
586
587 return false;
588 case 'imext':
589 $im = new Imagick();
590 $im->readImage( $params['srcPath'] );
591 if ( !$im->rotateImage( new ImagickPixel( 'white' ), 360 - $rotation ) ) {
592 return new MediaTransformError( 'thumbnail_error', 0, 0,
593 "Error rotating $rotation degrees" );
594 }
595 $result = $im->writeImage( $params['dstPath'] );
596 if ( !$result ) {
597 return new MediaTransformError( 'thumbnail_error', 0, 0,
598 "Unable to write image to {$params['dstPath']}" );
599 }
600
601 return false;
602 default:
603 return new MediaTransformError( 'thumbnail_error', 0, 0,
604 "$scaler rotation not implemented" );
605 }
606 }
607}
unserialize( $serialized)
$wgCustomConvertCommand
Use another resizing converter, e.g.
$wgMaxInterlacingAreas
Array of max pixel areas for interlacing per MIME type.
$wgUseImageResize
Whether to enable server-side image thumbnailing.
$wgJpegQuality
When scaling a JPEG thumbnail, this is the quality we request from the backend.
$wgEnableAutoRotation
If set to true, images that contain certain the exif orientation tag will be rotated accordingly.
$wgImageMagickTempDir
Temporary directory used for ImageMagick.
$wgSharpenReductionThreshold
Reduction in linear dimensions below which sharpening will be enabled.
$wgJpegPixelFormat
At default setting of 'yuv420', JPEG thumbnails will use 4:2:0 chroma subsampling to reduce file size...
$wgSharpenParameter
Sharpening parameter to ImageMagick.
$wgMaxAnimatedGifArea
Force thumbnailing of animated GIFs above this size to a single frame instead of an animated thumbnai...
$wgUseImageMagick
Resizing can be done using PHP's internal image libraries or using ImageMagick or another third-party...
$wgImageMagickConvertCommand
The convert command shipped with ImageMagick.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfEscapeShellArg(... $args)
Version of escapeshellarg() that works better on Windows.
wfShellExecWithStderr( $cmd, &$retval=null, $environ=[], $limits=[])
Execute a shell command, returning both stdout and stderr.
Generic handler for bitmap images.
canRotate()
Returns whether the current scaler supports rotation (im and gd do)
rotate( $file, $params)
static imageJpegWrapper( $dst_image, $thumbPath, $quality=null)
Callback for transformGd when transforming jpeg images.
transformImageMagick( $image, $params)
Transform an image using ImageMagick.
getScalerType( $dstPath, $checkDstPath=true)
Returns which scaler type should be used.
imageMagickSubsampling( $pixelFormat)
Get ImageMagick subsampling factors for the target JPEG pixel format.
transformCustom( $image, $params)
Transform an image using a custom command.
makeParamString( $params)
Merge a parameter array into a string appropriate for inclusion in filenames.
transformGd( $image, $params)
Transform an image using the built in GD library.
parseParamString( $str)
Parse a param string made with makeParamString back into an array.
normaliseParams( $image, &$params)
transformImageMagickExt( $image, $params)
Transform an image using the Imagick PHP extension.
validateParam( $name, $value)
Validate a thumbnail parameter at parse time.
getImageArea( $image)
Function that returns the number of pixels to be thumbnailed.
MediaWiki exception.
getRotation( $file)
On supporting image formats, try to read out the low-level orientation of the file and return the ang...
isAnimatedImage( $file)
The material is an image, and is animated.
logErrorForExternalProcess( $retval, $err, $cmd)
Log an error that occurred in an external process.
Basic media transform error class.
Handler for images that need to be transformed.
getMagickVersion()
Retrieve the version of the installed ImageMagick You can use PHPs version_compare() to use this valu...
escapeMagickInput( $path, $scene=false)
Escape a string for ImageMagick's input filenames.
escapeMagickProperty( $s)
Escape a string for ImageMagick's property input (e.g.
escapeMagickOutput( $path, $scene=false)
Escape a string for ImageMagick's output filename.
extractPreRotationDimensions( $params, $rotation)
Extracts the width/height if the image will be scaled before rotating.
getMediaTransformError( $params, $errMsg)
Get a MediaTransformError with error 'thumbnail_error'.
$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
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
Definition hooks.txt:266
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
Definition hooks.txt:181
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
Definition hooks.txt:925
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
returning false will NOT prevent logging $e
Definition hooks.txt:2226
$params