mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 06:03:49 +00:00
Change method used for file_bits_per_channel in /test
Using MWProps will not raise an 'undefined index' notice and, if the bitsdepth cannot be established, will return 0. This is way better than returning the empty string or null, which cannot be treated as integers. Bug: T218874 Change-Id: I2b585f3a2f257783c15f0fcdd2851f1e1ce4256b
This commit is contained in:
parent
edc35ede96
commit
45e84bad0e
|
@ -2891,12 +2891,15 @@ class AbuseFilter {
|
|||
$vars->setVar( 'file_mime', $file->getMimeType() );
|
||||
$vars->setVar(
|
||||
'file_mediatype',
|
||||
MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer()
|
||||
MediaWikiServices::getInstance()->getMimeAnalyzer()
|
||||
->getMediaType( null, $file->getMimeType() )
|
||||
);
|
||||
$vars->setVar( 'file_width', $file->getWidth() );
|
||||
$vars->setVar( 'file_height', $file->getHeight() );
|
||||
$vars->setVar( 'file_bits_per_channel', $file->getImageSize( $file->getLocalRefPath() )['bits'] );
|
||||
|
||||
$mwProps = new MWFileProps( MediaWikiServices::getInstance()->getMimeAnalyzer() );
|
||||
$bits = $mwProps->getPropsFromPath( $file->getLocalRefPath(), true )['bits'];
|
||||
$vars->setVar( 'file_bits_per_channel', $bits );
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue