[Pkg-mediawiki-commits] r383 - in mediawiki-extensions/trunk/debian: . patches

Thorsten Glaser tg at alioth.debian.org
Tue Oct 2 10:03:58 UTC 2012


Author: tg
Date: 2012-10-02 10:03:58 +0000 (Tue, 02 Oct 2012)
New Revision: 383

Modified:
   mediawiki-extensions/trunk/debian/changelog
   mediawiki-extensions/trunk/debian/patches/fix_collection.patch
Log:
Collection: fix downloading generated PDFs from the render server

This inlines a bit of mwServeCommand and Http::post() to be able
to get to the response headers. I think the isset($r['url']) is
the reason this ?\226?\128?\156might?\226?\128?\157 ever have worked for _some_ people since
that?\226?\128?\153s dependent on the version of the render server, but the one
we have at work does not set that (it cannot due to firewalling),
and the ?\226?\128?\156else?\226?\128?\157 clause could never possibly have worked?\226?\128?\166

Modified: mediawiki-extensions/trunk/debian/changelog
===================================================================
--- mediawiki-extensions/trunk/debian/changelog	2012-09-29 14:44:01 UTC (rev 382)
+++ mediawiki-extensions/trunk/debian/changelog	2012-10-02 10:03:58 UTC (rev 383)
@@ -1,3 +1,9 @@
+mediawiki-extensions (2.9) UNRELEASED; urgency=low
+
+  * Collection: fix downloading generated PDFs from the render server
+
+ -- Thorsten Glaser <tg at mirbsd.de>  Tue, 02 Oct 2012 12:01:42 +0200
+
 mediawiki-extensions (2.8) unstable; urgency=low
 
   * Remove dependency of mw-ext-collection on various ECMAscript

Modified: mediawiki-extensions/trunk/debian/patches/fix_collection.patch
===================================================================
--- mediawiki-extensions/trunk/debian/patches/fix_collection.patch	2012-09-29 14:44:01 UTC (rev 382)
+++ mediawiki-extensions/trunk/debian/patches/fix_collection.patch	2012-10-02 10:03:58 UTC (rev 383)
@@ -3,6 +3,7 @@
 Fix Collection extension:
 • Invalid XHTML nesting
 • Empty ul element
+• Fix downloading generated PDFs
 
 --- a/dist/mediawiki-extensions-collection/usr/share/mediawiki-extensions/collection/Collection.templates.php
 +++ b/dist/mediawiki-extensions-collection/usr/share/mediawiki-extensions/collection/Collection.templates.php
@@ -60,3 +61,45 @@
  
  </div>
  
+--- a/dist/mediawiki-extensions-collection/usr/share/mediawiki-extensions/collection/Collection.body.php
++++ b/dist/mediawiki-extensions-collection/usr/share/mediawiki-extensions/collection/Collection.body.php
+@@ -1092,13 +1092,34 @@ class SpecialCollection extends SpecialP
+ 			$content_length = $r['content_length'];
+ 			$content_disposition = $r['content_disposition'];
+ 		} else {
+-			$info = self::mwServeCommand( 'download', array(
++			global $wgCollectionMWServeURL, $wgCollectionFormatToServeURL, $wgCollectionMWServeCredentials;
++
++			$args = array(
++				'command' => 'download',
+ 				'collection_id' => $wgRequest->getVal( 'collection_id' ),
+ 				'writer' => $wgRequest->getVal( 'writer' ),
+-			) );
+-			$content_type = $info['content_type'];
+-			$content_length = $info['download_content_length'];
+-			$content_disposition = null;
++			    );
++			$serveURL = $wgCollectionMWServeURL;
++			if ( array_key_exists( $args['writer'], $wgCollectionFormatToServeURL ) )
++				$serveURL = $wgCollectionFormatToServeURL[ $args['writer'] ];
++			if ( $wgCollectionMWServeCredentials ) {
++				$args['login_credentials'] = $wgCollectionMWServeCredentials;
++			}
++			$options = array(
++				'postData' => $args,
++				'method' => 'POST',
++				'timeout' => 'default',
++			    );
++			$req = MWHttpRequest::factory($serveURL, $options);
++			$status = $req->execute();
++			$result = $status->isOK() ? $req->getContent() : false;
++			if ($result) {
++				fwrite($tempfile, $result);
++				$info = true;
++			}
++			$content_type = $req->getResponseHeader('content-type');
++			$content_length = $req->getResponseHeader('content-length');
++			$content_disposition = $req->getResponseHeader('content-disposition');
+ 		}
+ 		if ( !$info ) {
+ 			$wgOut->showErrorPage( 'coll-download_notfound_title', 'coll-download_notfound_text' );




More information about the Pkg-mediawiki-commits mailing list