MediaWiki r63695 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r63694‎ | r63695 (on ViewVC)‎ | r63696 >
Date:18:08, 13 March 2010
Author:maxsem
Status:resolved
Tags:
Comment:
new-installer: tweaks and refactoring of RELEASE-NOTES formatter
Modified paths:

Diff [purge]

Index: branches/new-installer/phase3/includes/installer/WebInstaller.php
===================================================================
--- branches/new-installer/phase3/includes/installer/WebInstaller.php	(revision 63694)
+++ branches/new-installer/phase3/includes/installer/WebInstaller.php	(revision 63695)
@@ -1594,28 +1594,36 @@
 	function getFileContents() {
 		return file_get_contents( dirname( __FILE__ ) . '/../../' . $this->getFileName() );
 	}
-}
 
-class WebInstaller_Readme extends WebInstaller_Document { 
-	function getFileName() { return 'README'; } 
-}
-class WebInstaller_ReleaseNotes extends WebInstaller_Document { 
-	function getFileName() { return 'RELEASE-NOTES'; } 
-	function getFileContents() {
-		$text = parent::getFileContents();
+	protected function formatTextFile( $text ) {
+		$text = preg_replace( "/\n\\*([^\r\n]*?)\r?\n[ \t]+/", "\n*\\1 ", $text );
 		$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;
 	}
+
 	private static function replaceBugLinks( $matches ) {
 		return '(<span class="config-plainlink">[https://bugzilla.wikimedia.org/show_bug.cgi?id=' .
-			$matches[1] . ' bug ' . $matches[1] . '])';
+			$matches[1] . ' bug ' . $matches[1] . ']</span>)';
 	}
+
 	private static function replaceConfigLinks( $matches ) {
 		return '<span class="config-plainlink">[http://www.mediawiki.org/wiki/Manual:' .
-			$matches[1] . ' ' . $matches[1] . ']';
+			$matches[1] . ' ' . $matches[1] . ']</span>';
 	}
 }
+
+class WebInstaller_Readme extends WebInstaller_Document { 
+	function getFileName() { return 'README'; } 
+}
+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'; } 
 }

Follow-up revisions

Rev.Commit summaryAuthorDate
r63699Apply 1337 regexes to README too, rm stray debugging code from r63695maxsem18:29, 13 March 2010

Status & tagging log

  • 01:36, 25 March 2010 ^demon (Talk | contribs) changed the status of r63695 [removed: new added: resolved]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox