X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FInstallDocFormatter.php;h=4163e2f958f9dc4ce2e04d710a982f37d447b1d4;hb=7d8766e80e670e9e408a25694ed5d24975b63864;hp=3250ff8a3a49bef611f340c5cd09a10f5225bd03;hpb=2e040b99eda6c99cf472b3896f62d2f21315e808;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/installer/InstallDocFormatter.php b/includes/installer/InstallDocFormatter.php
index 3250ff8a3a..4163e2f958 100644
--- a/includes/installer/InstallDocFormatter.php
+++ b/includes/installer/InstallDocFormatter.php
@@ -34,8 +34,8 @@ class InstallDocFormatter {
protected function execute() {
$text = $this->text;
// Use Unix line endings, escape some wikitext stuff
- $text = str_replace( array( '<', '{{', '[[', '__', "\r" ),
- array( '<', '{{', '[[', '__', '' ), $text );
+ $text = str_replace( [ '<', '{{', '[[', '__', "\r" ],
+ [ '<', '{{', '[[', '__', '' ], $text );
// join word-wrapped lines into one
do {
$prev = $text;
@@ -44,25 +44,31 @@ class InstallDocFormatter {
// Replace tab indents with colons
$text = preg_replace( '/^\t\t/m', '::', $text );
$text = preg_replace( '/^\t/m', ':', $text );
+
+ $linkStart = '[';
+ $linkEnd = ' $0]';
+
+ // turn (Tnnnn) into links
+ $text = preg_replace(
+ '/T\d+/',
+ "{$linkStart}https://phabricator.wikimedia.org/$0{$linkEnd}",
+ $text
+ );
+
// turn (bug nnnn) into links
- $text = preg_replace_callback( '/bug (\d+)/', array( $this, 'replaceBugLinks' ), $text );
+ $text = preg_replace(
+ '/bug (\d+)/',
+ "{$linkStart}https://bugzilla.wikimedia.org/$1{$linkEnd}",
+ $text
+ );
+
// add links to manual to every global variable mentioned
- $text = preg_replace_callback(
- '/(\$wg[a-z0-9_]+)/i',
- array( $this, 'replaceConfigLinks' ),
+ $text = preg_replace(
+ '/\$wg[a-z0-9_]+/i',
+ "{$linkStart}https://www.mediawiki.org/wiki/Manual:$0{$linkEnd}",
$text
);
return $text;
}
-
- protected function replaceBugLinks( $matches ) {
- return '[https://bugzilla.wikimedia.org/' .
- $matches[1] . ' bug ' . $matches[1] . ']';
- }
-
- protected function replaceConfigLinks( $matches ) {
- return '[https://www.mediawiki.org/wiki/Manual:' .
- $matches[1] . ' ' . $matches[1] . ']';
- }
}