Drop $wgDjvuToXML

The software behind this is abandoned and we are migrating djvu metadata
to json instead.

This doesn't affect production as we already use djvudump

Bug: T275268
Change-Id: If45ae5746ba91ba305f93603dc1e3aafba80a369
This commit is contained in:
Amir Sarabadani 2021-09-10 23:16:15 +02:00
parent 6b6e846de6
commit 64752c0fc4
5 changed files with 8 additions and 28 deletions

View file

@ -75,6 +75,8 @@ of automatic detection of possible phone numbers in a webpage in Safari on iOS.
* $wgLangObjCacheSize - The LanguageFactory service now always retains
at most 10 objects in its LRU-cache.
* (T274695) $wgAjaxEditStash, deprecated in 1.36.
* $wgDjvuToXML, without deprecation because it is obsolete and abandoned
upstream. Use $wgDjvuDump instead.
* …
=== New user-facing features in 1.37 ===

View file

@ -1797,22 +1797,6 @@ $wgDjvuRenderer = null;
*/
$wgDjvuTxt = null;
/**
* Path of the djvutoxml executable
* This works like djvudump except much, much slower as of version 3.5.
*
* For now we recommend you use djvudump instead. The djvuxml output is
* probably more stable, so we'll switch back to it as soon as they fix
* the efficiency problem.
* https://sourceforge.net/tracker/index.php?func=detail&aid=1704049&group_id=32953&atid=406583
*
* @par Example:
* @code
* $wgDjvuToXML = 'djvutoxml';
* @endcode
*/
$wgDjvuToXML = null;
/**
* Shell command for the DJVU post processor
* Default: pnmtojpeg, since ddjvu generates ppm output

View file

@ -40,8 +40,8 @@ class DjVuHandler extends ImageHandler {
* @return bool
*/
public function isEnabled() {
global $wgDjvuRenderer, $wgDjvuDump, $wgDjvuToXML;
if ( !$wgDjvuRenderer || ( !$wgDjvuDump && !$wgDjvuToXML ) ) {
global $wgDjvuRenderer, $wgDjvuDump;
if ( !$wgDjvuRenderer || !$wgDjvuDump ) {
wfDebug( "DjVu is disabled, please set \$wgDjvuRenderer and \$wgDjvuDump" );
return false;

View file

@ -249,22 +249,18 @@ class DjVuImage {
* @return string|bool
*/
public function retrieveMetaData() {
global $wgDjvuToXML, $wgDjvuDump, $wgDjvuTxt;
global $wgDjvuDump, $wgDjvuTxt;
if ( !$this->isValid() ) {
return false;
}
if ( isset( $wgDjvuDump ) ) {
# djvudump is faster as of version 3.5
# djvudump is faster than djvutoxml (now abandoned) as of version 3.5
# https://sourceforge.net/p/djvu/bugs/71/
$cmd = Shell::escape( $wgDjvuDump ) . ' ' . Shell::escape( $this->mFilename );
$dump = wfShellExec( $cmd );
$xml = $this->convertDumpToXML( $dump );
} elseif ( isset( $wgDjvuToXML ) ) {
$cmd = Shell::escape( $wgDjvuToXML ) . ' --without-anno --without-text ' .
Shell::escape( $this->mFilename );
$xml = wfShellExec( $cmd );
} else {
$xml = null;
}

View file

@ -29,11 +29,10 @@ class DjVuSupport {
* Initialises DjVu tools global with default values
*/
public function __construct() {
global $wgDjvuRenderer, $wgDjvuDump, $wgDjvuToXML, $wgFileExtensions, $wgDjvuTxt;
global $wgDjvuRenderer, $wgDjvuDump, $wgFileExtensions, $wgDjvuTxt;
$wgDjvuRenderer = $wgDjvuRenderer ?: '/usr/bin/ddjvu';
$wgDjvuDump = $wgDjvuDump ?: '/usr/bin/djvudump';
$wgDjvuToXML = $wgDjvuToXML ?: '/usr/bin/djvutoxml';
$wgDjvuTxt = $wgDjvuTxt ?: '/usr/bin/djvutxt';
if ( !in_array( 'djvu', $wgFileExtensions ) ) {
@ -47,11 +46,10 @@ class DjVuSupport {
* @return bool
*/
public function isEnabled() {
global $wgDjvuRenderer, $wgDjvuDump, $wgDjvuToXML, $wgDjvuTxt;
global $wgDjvuRenderer, $wgDjvuDump, $wgDjvuTxt;
return is_executable( $wgDjvuRenderer )
&& is_executable( $wgDjvuDump )
&& is_executable( $wgDjvuToXML )
&& is_executable( $wgDjvuTxt );
}
}