* @file
* @ingroup Media
*/
+use MediaWiki\MediaWikiServices;
/**
* Handler for DjVu images
/**
* @return bool
*/
- function isEnabled() {
+ public function isEnabled() {
global $wgDjvuRenderer, $wgDjvuDump, $wgDjvuToXML;
if ( !$wgDjvuRenderer || ( !$wgDjvuDump && !$wgDjvuToXML ) ) {
wfDebug( "DjVu is disabled, please set \$wgDjvuRenderer and \$wgDjvuDump\n" );
* @param array $params
* @return array
*/
- function getScriptParams( $params ) {
+ protected function getScriptParams( $params ) {
return [
'width' => $params['width'],
'page' => $params['page'],
return $this->getDjVuImage( $image, $path )->getImageSize();
}
- function getThumbType( $ext, $mime, $params = null ) {
+ public function getThumbType( $ext, $mime, $params = null ) {
global $wgDjvuOutputExtension;
static $mime;
if ( !isset( $mime ) ) {
return [ $wgDjvuOutputExtension, $mime ];
}
- function getMetadata( $image, $path ) {
+ public function getMetadata( $image, $path ) {
wfDebug( "Getting DjVu metadata for $path\n" );
$xml = $this->getDjVuImage( $image, $path )->retrieveMetaData();
return 'djvuxml';
}
- function isMetadataValid( $image, $metadata ) {
+ public function isMetadataValid( $image, $metadata ) {
return !empty( $metadata ) && $metadata != serialize( [] );
}
- function pageCount( File $image ) {
+ public function pageCount( File $image ) {
$info = $this->getDimensionInfo( $image );
return $info ? $info['pageCount'] : false;
}
- function getPageDimensions( File $image, $page ) {
+ public function getPageDimensions( File $image, $page ) {
$index = $page - 1; // MW starts pages at 1
$info = $this->getDimensionInfo( $image );
}
protected function getDimensionInfo( File $file ) {
- $cache = ObjectCache::getMainWANInstance();
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
return $cache->getWithSetCallback(
$cache->makeKey( 'file-djvu', 'dimensions', $file->getSha1() ),
$cache::TTL_INDEFINITE,