r48533 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48532‎ | r48533 | r48534 >
Date:20:36, 18 March 2009
Author:demon
Status:ok
Tags:
Comment:
Cleanup to r48486:
* Make this disable-able by setting $wgDjvutext to null by default (commented)
* Use wfFindFile instead of deprecated Image::newFromTitle
* Only apply this when it's a djvu mime type
Modified paths:
  • /trunk/extensions/ProofreadPage/ProofreadPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/ProofreadPage.php
@@ -14,7 +14,8 @@
1515 $wgHooks['ArticleSaveComplete'][] = 'pr_articleSave';
1616 $wgHooks['EditFormPreloadText'][] = 'pr_preloadText';
1717
18 -$wgDjvutxt = 'djvutxt';
 18+# Allows for extracting text from djvu files. To enable, set to 'djvutxt' or similar
 19+$wgDjvutxt = null;
1920
2021
2122 $wgExtensionCredits['other'][] = array(
@@ -659,15 +660,15 @@
660661
661662 $page_namespace = preg_quote( wfMsgForContent( 'proofreadpage_namespace' ), '/' );
662663
663 - if ( preg_match( "/^$page_namespace:(.*?)\/([0-9]*)$/", $mTitle->getPrefixedText(), $m ) ) {
 664+ if ( $wgDjvutxt && preg_match( "/^$page_namespace:(.*?)\/([0-9]*)$/", $mTitle->getPrefixedText(), $m ) ) {
664665
665666 $imageTitle = Title::makeTitleSafe( NS_IMAGE, $m[1] );
666667 if ( !$imageTitle ) {
667668 return true;
668669 }
669670
670 - $image = Image::newFromTitle( $imageTitle );
671 - if ( $image->exists() ) {
 671+ $image = wfFindFile( $title );
 672+ if ( $image->exists() && $image->getMimeType() == 'image/vnd.djvu' ) {
672673 $srcPath = $image->getPath();
673674 $cmd = "( " .wfEscapeShellArg( $wgDjvutxt );
674675 $cmd .= " --page {$m[2]} ". wfEscapeShellArg( $srcPath )." )";

Follow-up revisions

RevisionCommit summaryAuthorDate
r48536fix bug introduced in r48533 (variable name)thomasv20:55, 18 March 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r48486if available, extract text using djvutxtthomasv14:04, 17 March 2009

Status & tagging log