From dbb3a6f778384e96ca5da8a625e7a1d44523e7f7 Mon Sep 17 00:00:00 2001 From: Dereckson Date: Fri, 7 Dec 2012 22:00:41 +0100 Subject: [PATCH] Memory setting for djvutext is now a constant This is a follow-up for change Ia735e1b7. See also bug 42466. Change-Id: I67d8ae9000713c349c7506e9a77d350c89992400 --- includes/media/DjVuImage.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/includes/media/DjVuImage.php b/includes/media/DjVuImage.php index bdedbd1488..cad9c1b72a 100644 --- a/includes/media/DjVuImage.php +++ b/includes/media/DjVuImage.php @@ -34,10 +34,20 @@ * @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 -- 2.20.1