r63695 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63694‎ | r63695 | r63696 >
Date:18:08, 13 March 2010
Author:maxsem
Status:resolved
Tags:
Comment:
new-installer: tweaks and refactoring of RELEASE-NOTES formatter
Modified paths:
  • /branches/new-installer/phase3/includes/installer/WebInstaller.php (modified) (history)

Diff [purge]

Index: branches/new-installer/phase3/includes/installer/WebInstaller.php
@@ -1594,28 +1594,36 @@
15951595 function getFileContents() {
15961596 return file_get_contents( dirname( __FILE__ ) . '/../../' . $this->getFileName() );
15971597 }
1598 -}
15991598
1600 -class WebInstaller_Readme extends WebInstaller_Document {
1601 - function getFileName() { return 'README'; }
1602 -}
1603 -class WebInstaller_ReleaseNotes extends WebInstaller_Document {
1604 - function getFileName() { return 'RELEASE-NOTES'; }
1605 - function getFileContents() {
1606 - $text = parent::getFileContents();
 1599+ protected function formatTextFile( $text ) {
 1600+ $text = preg_replace( "/\n\\*([^\r\n]*?)\r?\n[ \t]+/", "\n*\\1 ", $text );
16071601 $text = preg_replace_callback('/\(bug (\d+)\)/', array( 'WebInstaller_ReleaseNotes', 'replaceBugLinks' ), $text );
16081602 $text = preg_replace_callback('/(\$wg[a-z0-9_]+)/i', array( 'WebInstaller_ReleaseNotes', 'replaceConfigLinks' ), $text );
16091603 return $text;
16101604 }
 1605+
16111606 private static function replaceBugLinks( $matches ) {
16121607 return '(<span class="config-plainlink">[https://bugzilla.wikimedia.org/show_bug.cgi?id=' .
1613 - $matches[1] . ' bug ' . $matches[1] . '])';
 1608+ $matches[1] . ' bug ' . $matches[1] . ']</span>)';
16141609 }
 1610+
16151611 private static function replaceConfigLinks( $matches ) {
16161612 return '<span class="config-plainlink">[http://www.mediawiki.org/wiki/Manual:' .
1617 - $matches[1] . ' ' . $matches[1] . ']';
 1613+ $matches[1] . ' ' . $matches[1] . ']</span>';
16181614 }
16191615 }
 1616+
 1617+class WebInstaller_Readme extends WebInstaller_Document {
 1618+ function getFileName() { return 'README'; }
 1619+}
 1620+class WebInstaller_ReleaseNotes extends WebInstaller_Document {
 1621+ function getFileName() { return 'RELEASE-NOTES'; }
 1622+
 1623+ function getFileContents() {
 1624+ echo $this->formatTextFile( parent::getFileContents() );
 1625+ return $this->formatTextFile( parent::getFileContents() );
 1626+ }
 1627+}
16201628 class WebInstaller_Copying extends WebInstaller_Document {
16211629 function getFileName() { return 'COPYING'; }
16221630 }

Follow-up revisions

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

Status & tagging log