MediaWiki r63699 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r63698‎ | r63699 (on ViewVC)‎ | r63700 >
Date:18:29, 13 March 2010
Author:maxsem
Status:ok (Comments)
Tags:
Comment:
Apply 1337 regexes to README too, rm stray debugging code from r63695
Modified paths:

Diff [purge]

Index: branches/new-installer/phase3/includes/installer/WebInstaller.php
===================================================================
--- branches/new-installer/phase3/includes/installer/WebInstaller.php	(revision 63698)
+++ branches/new-installer/phase3/includes/installer/WebInstaller.php	(revision 63699)
@@ -1596,7 +1596,11 @@
 	}
 
 	protected function formatTextFile( $text ) {
-		$text = preg_replace( "/\n\\*([^\r\n]*?)\r?\n[ \t]+/", "\n*\\1 ", $text );
+		$text = preg_replace( "/\r?\n(\r?\n)?\\[\\d+\\]/m", "\\1#", $text );
+		do {
+			$prev = $text;
+			$text = preg_replace( "/\n([\\*#])([^\r\n]*?)\r?\n([^\r\n#\\*:]+)/", "\n\\1\\2 \\3", $text );
+		} while ( $text != $prev );
 		$text = preg_replace_callback('/\(bug (\d+)\)/', array( 'WebInstaller_ReleaseNotes', 'replaceBugLinks' ), $text );
 		$text = preg_replace_callback('/(\$wg[a-z0-9_]+)/i', array( 'WebInstaller_ReleaseNotes', 'replaceConfigLinks' ), $text );
 		return $text;
@@ -1615,15 +1619,20 @@
 
 class WebInstaller_Readme extends WebInstaller_Document { 
 	function getFileName() { return 'README'; } 
+
+	function getFileContents() {
+		return $this->formatTextFile( parent::getFileContents() );
+	}
 }
+
 class WebInstaller_ReleaseNotes extends WebInstaller_Document { 
 	function getFileName() { return 'RELEASE-NOTES'; }
 
 	function getFileContents() {
-		echo $this->formatTextFile( parent::getFileContents() );
 		return $this->formatTextFile( parent::getFileContents() );
 	}
 }
+
 class WebInstaller_Copying extends WebInstaller_Document { 
 	function getFileName() { return 'COPYING'; } 
 }

Comments

#Comment by Simetrical (Talk | contribs)   17:57, 16 March 2010

This looks like a good candidate for the /x modifier, so that it might actually become readable.

Status & tagging log

  • 18:50, 30 April 2010 ^demon (Talk | contribs) changed the status of r63699 [removed: new added: ok]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox