Mediawiki代码研究

来自个人维基
跳转至: 导航搜索
  • $wgRequest的创建:


Setup.php
$wgRequest = new WebRequest;


  • url 参数解析:
WebRequest.getPathInfo -> PathRouter.parse


  • 数据库管理
DatabaseMysql -extends-> DatabaseBase -implements-> DatabaseType
  • 权限管理

includes/Title.php.Title->getUserPermissionsErrorsInternal:2255
includes/Title.php.Title->userCan:1692
includes/Title.php.Title->quickUserCan:1674

  • 获取logo

includes/Skin.php.Skin->getLogo:415

  • 将wiki语法翻译成html
	/**
	 * Parse wikitext, strip paragraphs, and return the HTML.
	 *
	 * @param $text String
	 * @param $linestart Boolean: is this the start of a line?
	 * @param $interface Boolean: use interface language ($wgLang instead of
	 *                   $wgContLang) while parsing language sensitive magic
	 *                   words like GRAMMAR and PLURAL
	 * @return String: HTML
	 */
	public function parseInline( $text, $linestart = true, $interface = false ) 
  • 所有的SpecialPage都是通过以下方式处理的:
SpecialPageFactory::executePath() -> SpecailPage->run() -> SpecialXXXXXX->excute()