r84408 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84407‎ | r84408 | r84409 >
Date:17:54, 20 March 2011
Author:maxsem
Status:ok
Tags:
Comment:
Fixed <doclink> broken by r83023
Modified paths:
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstaller.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/WebInstaller.php
@@ -115,9 +115,10 @@
116116 $this->output = new WebInstallerOutput( $this );
117117 $this->request = $request;
118118
119 - // Add parser hook for WebInstaller_Complete
 119+ // Add parser hooks
120120 global $wgParser;
121121 $wgParser->setHook( 'downloadlink', array( $this, 'downloadLinkHook' ) );
 122+ $wgParser->setHook( 'doclink', array( $this, 'docLink' ) );
122123 }
123124
124125 /**
@@ -994,6 +995,16 @@
995996 }
996997
997998 /**
 999+ * Extension tag hook for a documentation link.
 1000+ */
 1001+ public function docLink( $linkText, $attribs, $parser ) {
 1002+ $url = $this->getDocUrl( $attribs['href'] );
 1003+ return '<a href="' . htmlspecialchars( $url ) . '">' .
 1004+ htmlspecialchars( $linkText ) .
 1005+ '</a>';
 1006+ }
 1007+
 1008+ /**
9981009 * Helper for "Download LocalSettings" link on WebInstall_Complete
9991010 * @return String Html for download link
10001011 */
Index: trunk/phase3/includes/installer/Installer.php
@@ -317,9 +317,6 @@
318318 // Having a user with id = 0 safeguards us from DB access via User::loadOptions().
319319 $wgUser = User::newFromId( 0 );
320320
321 - // Set our custom <doclink> hook.
322 - $wgHooks['ParserFirstCallInit'][] = array( $this, 'registerDocLink' );
323 -
324321 $this->settings = $this->internalDefaults;
325322
326323 foreach ( $this->defaultVarNames as $var ) {
@@ -1142,18 +1139,6 @@
11431140 }
11441141
11451142 /**
1146 - * Register tag hook below.
1147 - *
1148 - * @todo Move this to WebInstaller with the two things below?
1149 - *
1150 - * @param $parser Parser
1151 - */
1152 - public function registerDocLink( Parser &$parser ) {
1153 - $parser->setHook( 'doclink', array( $this, 'docLink' ) );
1154 - return true;
1155 - }
1156 -
1157 - /**
11581143 * ParserOptions are constructed before we determined the language, so fix it
11591144 */
11601145 public function setParserLanguage( $lang ) {
@@ -1162,16 +1147,6 @@
11631148 }
11641149
11651150 /**
1166 - * Extension tag hook for a documentation link.
1167 - */
1168 - public function docLink( $linkText, $attribs, $parser ) {
1169 - $url = $this->getDocUrl( $attribs['href'] );
1170 - return '<a href="' . htmlspecialchars( $url ) . '">' .
1171 - htmlspecialchars( $linkText ) .
1172 - '</a>';
1173 - }
1174 -
1175 - /**
11761151 * Overridden by WebInstaller to provide lastPage parameters.
11771152 */
11781153 protected function getDocUrl( $page ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83023Kill all other uses of $wgHooks in includeExtensions() other than LoadExtensi...demon17:54, 1 March 2011

Status & tagging log