From: umherirrender Date: Mon, 29 Sep 2014 18:53:43 +0000 (+0200) Subject: Do not read metadata from non-existing djvu image X-Git-Tag: 1.31.0-rc.0~13764^2 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=4cb84c5a4fd1c436fd080bf4b04012f86f41f450;p=lhc%2Fweb%2Fwiklou.git Do not read metadata from non-existing djvu image Tests are printing: *** [1-11711] Failed to open 'some-nonexistent-file': No such file or directory. *** (ByteStream.cpp:693) *** 'DJVU::GUTF8String DJVU::ByteStream::Stdio::init(const DJVU::GURL&, const char*)' djvutxt: [1-11711] Failed to open 'some-nonexistent-file': No such file or directory. djvutxt: 'ByteStream.cpp:693' That just spamming the logs, so adding a valid check before do anything. Change-Id: Ia77377e632587ede76af4c722a1b8ac34fa50e1c --- diff --git a/includes/media/DjVuImage.php b/includes/media/DjVuImage.php index 6ff19c9007..596d3e8176 100644 --- a/includes/media/DjVuImage.php +++ b/includes/media/DjVuImage.php @@ -265,12 +265,16 @@ class DjVuImage { /** * Return an XML string describing the DjVu image - * @return string + * @return string|bool */ function retrieveMetaData() { global $wgDjvuToXML, $wgDjvuDump, $wgDjvuTxt; wfProfileIn( __METHOD__ ); + if ( !$this->isValid() ) { + return false; + } + if ( isset( $wgDjvuDump ) ) { # djvudump is faster as of version 3.5 # http://sourceforge.net/tracker/index.php?func=detail&aid=1704049&group_id=32953&atid=406583