Memory setting for djvutext is now a constant
authorDereckson <dereckson@espace-win.org>
Fri, 7 Dec 2012 21:00:41 +0000 (22:00 +0100)
committerDereckson <dereckson@espace-win.org>
Fri, 7 Dec 2012 23:31:23 +0000 (00:31 +0100)
This is a follow-up for change Ia735e1b7.
See also bug 42466.

Change-Id: I67d8ae9000713c349c7506e9a77d350c89992400

includes/media/DjVuImage.php

index bdedbd1..cad9c1b 100644 (file)
  * @ingroup Media
  */
 class DjVuImage {
+       /**
+        * Constructor
+        *
+        * @param string $filename The DjVu file name.
+        */
        function __construct( $filename ) {
                $this->mFilename = $filename;
        }
 
+        /**
+         * @const DJVUTXT_MEMORY_LIMIT Memory limit for the DjVu description software
+         */
+       const DJVUTXT_MEMORY_LIMIT = 300000;
+
        /**
         * Check if the given file is indeed a valid DjVu image file
         * @return bool
@@ -252,7 +262,7 @@ class DjVuImage {
                        $cmd = wfEscapeShellArg( $wgDjvuTxt ) . ' --detail=page ' . wfEscapeShellArg( $this->mFilename ) ;
                        wfDebug( __METHOD__.": $cmd\n" );
                        $retval = '';
-                       $txt = wfShellExec( $cmd, $retval, array(), array( 'memory' => 300000 ) );
+                       $txt = wfShellExec( $cmd, $retval, array(), array( 'memory' => self::DJVUTXT_MEMORY_LIMIT ) );
                        wfProfileOut( 'djvutxt' );
                        if( $retval == 0) {
                                # Strip some control characters