From c9974f332586c17eaa2bccd1600aa832872692aa Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 20 Aug 2008 01:40:35 +0000 Subject: [PATCH] Part two of allowing Special:Export to work on very long page histories... Part 1 was disabling the output buffers, allowing us to stream output continuously. Part 2, here, is to use an unbuffered query to load the page/revision data, as we do for the command-line scripts. (This is done in what Tim assures me is a portable, database-neutral way, unlike all the maint scripts which still use old hacks.) This lets us actually stream the *input* -- otherwise streaming the output is darn useless! Part 3 will be fixing up things like the max execution time. :) --- includes/specials/SpecialExport.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index b17140d885..a8ba2be438 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -1,5 +1,5 @@ +# Copyright (C) 2003-2008 Brion Vibber # http://www.mediawiki.org/ # # This program is free software; you can redistribute it and/or modify @@ -223,8 +223,18 @@ function wfSpecialExport( $page = '' ) { /* Ok, let's get to it... */ - $db = wfGetDB( DB_SLAVE ); - $exporter = new WikiExporter( $db, $history ); + if( $history == WikiExporter::CURRENT ) { + $lb = false; + $db = wfGetDB( DB_SLAVE ); + $buffer = WikiExporter::BUFFER; + } else { + // Use an unbuffered query; histories may be very long! + $lb = wfGetLBFactory()->newMainLB(); + $db = $lb->getConnection( DB_LAST ); + $buffer = WikiExporter::STREAM; + } + + $exporter = new WikiExporter( $db, $history, $buffer ); $exporter->list_authors = $list_authors ; $exporter->openStream(); @@ -251,6 +261,9 @@ function wfSpecialExport( $page = '' ) { } $exporter->closeStream(); + if( $lb ) { + $lb->closeAll(); + } return; } -- 2.20.1