From: Jens Frank Date: Sun, 27 Aug 2006 18:36:54 +0000 (+0000) Subject: update metadata for old images, ignore page= if no djvu renderer has been supplied X-Git-Tag: 1.31.0-rc.0~55898 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=41440bf5167599b1297705d53422aa17abae851a;p=lhc%2Fweb%2Fwiklou.git update metadata for old images, ignore page= if no djvu renderer has been supplied --- diff --git a/includes/Image.php b/includes/Image.php index f329fedd92..25960369dd 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -2265,9 +2265,22 @@ class Image } function initializeMultiPageXML() { + # + # Check for files uploaded prior to DJVU support activation + # They have a '0' in their metadata field. + # if ( $this->metadata == '0' ) { $deja = new DjVuImage( $this->imagePath ); $this->metadata = $deja->retrieveMetaData(); + $this->purgeMetadataCache(); + + # Update metadata in the database + $dbw =& wfGetDB( DB_MASTER ); + $dbw->update( 'image', + array( 'img_metadata' => $this->metadata ), + array( 'img_name' => $this->name ), + __METHOD__ + ); } $this->multiPageXML = new SimpleXMLElement( $this->metadata ); } diff --git a/includes/Parser.php b/includes/Parser.php index 56b4ccb30e..5692387841 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -4153,7 +4153,7 @@ class Parser * Parse image options text and use it to make an image */ function makeImage( &$nt, $options ) { - global $wgUseImageResize; + global $wgUseImageResize, $wgDjvuRenderer; $align = ''; @@ -4203,7 +4203,8 @@ class Parser } elseif ( ! is_null( $mwNone->matchVariableStartToEnd($val) ) ) { # remember to set an alignment, don't render immediately $align = 'none'; - } elseif ( ! is_null( $match = $mwPage->matchVariableStartToEnd($val) ) ) { + } elseif ( isset( $wgDjvuRenderer ) && $wgDjvuRenderer + && ! is_null( $match = $mwPage->matchVariableStartToEnd($val) ) ) { # Select a page in a multipage document $page = $match; } elseif ( $wgUseImageResize && ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) {