手册:install.php
Appearance
| MediaWiki文件: install.php | |
|---|---|
| 位置: | maintenance/ |
| 源代码: | master • 1.45.1 • 1.44. • 1.39.16 |
| 类: | CommandLineInstaller |
详情
install.php文件是一个基于CLI的维护脚本,用于安装并配置MediaWiki。
此脚本创建一个新的LocalSettings.php并填充给定的数据库。
如果LocalSettings.php文件已存在,并且无法从该文件中读取现有设置,则它将中止。
用法
php maintenance/run.php install [--conf|--confpath|--dbgroupdefault|--dbname|--dbpass|--dbpassfile|--dbpath|--dbport|--dbprefix|--dbschema|--dbserver|--dbtype|--dbuser|--env-checks|--globals|--help|--installdbpass|--installdbuser|--lang|--memory-limit|--pass|--passfile|--profiler|--quiet|--scriptpath|--server|--skins|--wiki|--with-extensions] <name> <admin>
下表说明了各种选项和参数。其选项的默认值在括号中指示。
通用维护参数:
| --help (-h) | 显示此帮助消息 |
| --quiet (-q) | 是否取消无错误输出 |
| --conf | LocalSettings.php的位置,如果不在默认位置。 此设置对此脚本没有影响并将被忽略。 Use --confpath instead.
|
| --wiki | 用于指定维基ID |
| --globals | 处理结束时输出全局变量以进行调试 |
| --memory-limit | 为脚本设置特定的内存限制,“max”表示没有限制,“Default”表示避免更改 |
| --server | 要在URL中使用的协议和服务器名称,例如https://en.wikipedia.org。这有时是必要的,因为在命令行脚本中服务器名称检测可能会失败。 |
| --profiler | 探查器输出格式(通常为“文本”) |
脚本相关参数
| --dbuser | 要用于此脚本的数据库用户。对于$wgDBuser,此值显示在LocalSettings.php中。如果给定--installdbuser和--installdbpass,则该值将用于创建新帐户
|
| --dbpass | 用于此脚本的密码。该值出现在LocalSettings.php中,表示$wgDBpassword。如果给定‘--installdbuser’和‘--installdbpass’,则该值将用于创建新帐户
|
| --dbgroupdefault | 要使用的默认数据库组 |
脚本特定参数
| Name | Description | Default |
|---|---|---|
| --confpath | 将写入LocalSettings.php的路径
|
value which by default, corresponds to $IP, i.e. the path of your installation's root folder. You can use --help to find the default value.
You may want to use this if you are adding a new wiki to a wiki family.
After the file has been generated, you can add a LocalSettings.php to the root folder that directs web requests to the wiki-specific LocalSettings.php in your custom path. Do not add it before the file has been generated: regardless what |
| --dbname | 数据库名称 | my_wiki |
| --dbpassfile | 提供DBPASS选项的另一种方法,因为此文件的内容 | |
| --dbpath | SQLite数据库的路径 | $IP/data
|
| --dbport | 数据库端口;仅适用于PostgreSQL | 5432 |
| --dbprefix | (可选的)数据库表名前缀 (不适用于SQLite) | |
| --dbschema | PostgreSQL/Microsoft SQL Server中MediaWiki数据库的模式 | mediawiki |
| --dbserver | 数据库主机 | localhost |
| --dbtype | 数据库类别 | mysql |
| --env-checks | 仅运行环境检查,不更改任何内容 | |
| --installdbpass | 数据库用户安装为的密码 | |
| --installdbuser | 用于安装的用户 | root |
| --lang | 使用的语言 | en |
| --pass | 维基管理员的密码 | |
| --passfile | 提供PASS选项的另一种方式,因为此文件的内容 | |
| --scriptpath | Wiki在Web服务器中的相对路径 | /wiki |
| --skins | 要安装的外观的逗号分隔列表 | all |
| --with-extensions | 检测并包含扩展 | |
| --with-developmentsettings | Load DevelopmentSettings.php in LocalSettings.php 自从MediaWiki 1.42 • change 977136 |
参数
| <name> | 该维基的名称 |
| <admin> | 维基管理员的用户名 |
示例
使用在数据库中具有所需权限的用户设置Wiki,为命名为“Wiki Name”的Wiki创建新数据库,并使用名为“Admin”的用户操作该Wiki:
php maintenance/run.php install \
--dbname=wikidb \
--dbserver="localhost" \
--installdbuser=root \
--installdbpass=rootpassword \
--dbuser=dbusername \
--dbpass=dbuserpassword \
--server="http://wiki.example.com/" \
--scriptpath=/w \
--lang=en \
--pass=Adminpassword "Wiki Name" "Admin"
See also
- installPreConfigured.php - alternative install script introduced in MediaWiki 1.44 which retrieves configuration details from an existing LocalSettings.php.