r12384 - Code Review

From MediaWiki.org

Jump to: navigation, search
Repository:MediaWiki
Revision:r12383 | r12384 (on ViewVC) | r12385 >
Date:23:32, 3 January 2006
Author:vibber
Status:new
Tags:
Comment:* (bug 4446) $wgExportAllowHistory option to explicitly disable history in
Special:Export form, 'exportnohistory' message to translate live hack.
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/SpecialExport.php
===================================================================
--- trunk/phase3/includes/SpecialExport.php	(revision 12383)
+++ trunk/phase3/includes/SpecialExport.php	(revision 12384)
@@ -31,10 +31,15 @@
  */
 function wfSpecialExport( $page = '' ) {
 	global $wgOut, $wgRequest;
+	global $wgExportAllowHistory;
 	
 	if( $wgRequest->getVal( 'action' ) == 'submit') {
 		$page = $wgRequest->getText( 'pages' );
-		$curonly = $wgRequest->getCheck( 'curonly' );
+		if( $wgExportAllowHistory ) {
+			$curonly = $wgRequest->getCheck( 'curonly' );
+		} else {
+			$curonly = true;
+		}
 	} else {
 		# Pre-check the 'current version only' box in the UI
 		$curonly = true;
@@ -57,12 +62,18 @@
 	$wgOut->addWikiText( wfMsg( "exporttext" ) );
 	$titleObj = Title::makeTitle( NS_SPECIAL, "Export" );
 	$action = $titleObj->escapeLocalURL( 'action=submit' );
+	if( $wgExportAllowHistory ) {
+		$checkbox = "<label><input type='checkbox' name='curonly' value='true' checked='checked' />
+" . wfMsgHtml( 'exportcuronly' ) . "</label><br />";
+	} else {
+		$checkbox = "";
+		$wgOut->addWikiText( wfMsg( "exportnohistory" ) );
+	}
 	$wgOut->addHTML( "
 <form method='post' action=\"$action\">
 <input type='hidden' name='action' value='submit' />
 <textarea name='pages' cols='40' rows='10'></textarea><br />
-<label><input type='checkbox' name='curonly' value='true' checked='checked' />
-" . wfMsgHtml( 'exportcuronly' ) . "</label><br />
+$checkbox
 <input type='submit' />
 </form>
 " );
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 12383)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 12384)
@@ -1321,6 +1321,12 @@
  */
 $wgImportSources = array();
 
+/**
+ * If set to false, disables the full-history option on Special:Export.
+ * This is currently poorly optimized for long edit histories, so is
+ * disabled on Wikimedia's sites.
+ */
+$wgExportAllowHistory = true;
 
 
 /** Text matching this regular expression will be recognised as spam
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 12383)
+++ trunk/phase3/RELEASE-NOTES	(revision 12384)
@@ -401,6 +401,8 @@
 * (bug 4456) Add hook for marking article patrolled
 * (bug 3194) default implementation of translateBlockExpiry
   which uses ipboptions
+* (bug 4446) $wgExportAllowHistory option to explicitly disable history in
+  Special:Export form, 'exportnohistory' message to translate live hack.
 
 
 === Caveats ===
Index: trunk/phase3/languages/Language.php
===================================================================
--- trunk/phase3/languages/Language.php	(revision 12383)
+++ trunk/phase3/languages/Language.php	(revision 12384)
@@ -1611,6 +1611,8 @@
 
 In the latter case you can also use a link, e.g. [[{{ns:Special}}:Export/{{Mediawiki:mainpage}}]] for the page {{Mediawiki:mainpage}}.',
 'exportcuronly'	=> 'Include only the current revision, not the full history',
+'exportnohistory' => "----
+'''Note:''' exporting the full history of pages through this form has been disabled due to performance reasons.",
 
 # Namespace 8 related
 
Views
Toolbox