This page is a translated version of the page Manual:$wgDBname and the translation is 100% complete.
数据库设置: $wgDBname
数据库名称。
引进版本:pre 1.1.0
移除版本:仍在使用
允许的值:(字符串)
默认值:'my_wiki' (1.14+)
'wikidb' (pre-1.1.0 - 1.13)

详情

当前安装的MediaWiki使用的数据库的名称。

  小心:
  • Do not change $wgDBmwschema after Setup.php has been included. 注意: Setup.php initializes various paths, includes some common files, starts sessions, and performs various other setup tasks for a request. 它与 MediaWiki 的安装或设置无关。
  • Only files in includes/db/ should use $wgDBmwschema, while everything else should use the dbSchema() method provided by the Wikimedia\Rdbms\IDatabase interface or extract it from the getDomainId() method in either the Wikimedia\Rdbms\ILoadBalancer or the Wikimedia\Rdbms\ILBFactory interface. The DatabaseDomain class can extract such components from a database domain ID.
  • If you configure $wgDBservers or $wgLBFactoryConf, you still need to define $wgDBname, $wgDBmwschema (if applicable for the DB type), and $wgDBprefix (if applicable for the DB type). The combination of $wgDBname, $wgDBmwschema, and $wgDBprefix define the current wiki's database domain. 这也称为本地数据库域The 'dbname' and 'tablePrefix' settings in $wgDBservers and $wgLBFactoryConf only define the default DB/prefix when a connection is requested with DatabaseDomain::newUnspecified()->getId() (the empty string) as the database domain, e.g. wfGetDB( DB_REPLICA, [], '' ). Note that functions calls like wfGetDB( DB_REPLICA ), which simply omit the database domain, are assumed to refer to the local database domain.

参见

  • 手册:数据库访问 – 包含使用MediaWiki中的数据库和数据库引擎的概述。
  • all.dblist - 维基媒体服务器中使用的数据库名称的完整列表