Index: trunk/extensions/ProofreadPage/ProofreadPage.php |
— | — | @@ -14,7 +14,8 @@ |
15 | 15 | $wgHooks['ArticleSaveComplete'][] = 'pr_articleSave'; |
16 | 16 | $wgHooks['EditFormPreloadText'][] = 'pr_preloadText'; |
17 | 17 | |
18 | | -$wgDjvutxt = 'djvutxt'; |
| 18 | +# Allows for extracting text from djvu files. To enable, set to 'djvutxt' or similar |
| 19 | +$wgDjvutxt = null; |
19 | 20 | |
20 | 21 | |
21 | 22 | $wgExtensionCredits['other'][] = array( |
— | — | @@ -659,15 +660,15 @@ |
660 | 661 | |
661 | 662 | $page_namespace = preg_quote( wfMsgForContent( 'proofreadpage_namespace' ), '/' ); |
662 | 663 | |
663 | | - if ( preg_match( "/^$page_namespace:(.*?)\/([0-9]*)$/", $mTitle->getPrefixedText(), $m ) ) { |
| 664 | + if ( $wgDjvutxt && preg_match( "/^$page_namespace:(.*?)\/([0-9]*)$/", $mTitle->getPrefixedText(), $m ) ) { |
664 | 665 | |
665 | 666 | $imageTitle = Title::makeTitleSafe( NS_IMAGE, $m[1] ); |
666 | 667 | if ( !$imageTitle ) { |
667 | 668 | return true; |
668 | 669 | } |
669 | 670 | |
670 | | - $image = Image::newFromTitle( $imageTitle ); |
671 | | - if ( $image->exists() ) { |
| 671 | + $image = wfFindFile( $title ); |
| 672 | + if ( $image->exists() && $image->getMimeType() == 'image/vnd.djvu' ) { |
672 | 673 | $srcPath = $image->getPath(); |
673 | 674 | $cmd = "( " .wfEscapeShellArg( $wgDjvutxt ); |
674 | 675 | $cmd .= " --page {$m[2]} ". wfEscapeShellArg( $srcPath )." )"; |