Skip to content

Commit 4d8f8b0

Browse files
authored
Merge pull request #422 from seatonjiang/patch-1
2 parents 8b51619 + bd80965 commit 4d8f8b0

File tree

1 file changed

+60
-32
lines changed

1 file changed

+60
-32
lines changed

zh-cn/index.md

Lines changed: 60 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,48 @@
11
---
22
layout: default
3-
title: WordPress 命令行交互界面
3+
title: WP-CLI | WP-CLI
44
direction: ltr
55
---
66

7-
[WP-CLI](https://wp-cli.org/) 是一款用于管理 [WordPress](https://wordpress.org/) 的命令行交互界面,无需浏览器即可完成插件更新,多站点设置等许多操作。
8-
9-
可以通过[以下方式](https://make.wordpress.org/cli/2019/06/27/thanks-to-the-2019-sponsors/)进行持续维护:
10-
11-
<a href="https://automattic.com/"><img src="https://make.wordpress.org/cli/files/2017/04/automattic-1.png" style="width:19%;height:auto;display:inline-block;vertical-align:middle;" alt="" width="160" height="35" class="aligncenter size-full wp-image-347" /></a> <a href="https://www.bluehost.com/"><img class="aligncenter size-full wp-image-335" style="width:19%;height:auto;display:inline-block;vertical-align:middle;" src="https://make.wordpress.org/cli/files/2017/04/bluehost.png" alt="" width="160" height="26" /></a> <a href="https://pantheon.io/"><img class="aligncenter size-full wp-image-333" style="width:19%;height:auto;display:inline-block;vertical-align:middle;" src="https://make.wordpress.org/cli/files/2019/06/pantheon.png" alt="" width="160" height="50" /></a> <a href="https://www.siteground.com/"><img class="aligncenter size-full wp-image-332" style="width:19%;height:auto;display:inline-block;vertical-align:middle;" src="https://make.wordpress.org/cli/files/2019/06/SG_logo.png" alt="" width="160" height="33" /></a> <a href="https://wpengine.com/"><img class="aligncenter size-full wp-image-333" style="width:19%;height:auto;display:inline-block;vertical-align:middle;" src="https://make.wordpress.org/cli/files/2017/04/wpengine.png" alt="" width="160" height="30" /></a>
12-
13-
目前的稳定版本是 [2.4.0](https://make.wordpress.org/cli/2019/11/12/wp-cli-v2-4-0-release-notes/)。如果您想获取最新信息,请在 Twitter 上关注 [@wpcli](https://twitter.com/wpcli) 或者 [订阅邮件通知](https://make.wordpress.org/cli/subscribe/)。请参阅 [产品路线图](https://make.wordpress.org/cli/handbook/roadmap/) 了解未来更新规划。
14-
15-
[![Testing](https://github.com/wp-cli/wp-cli/actions/workflows/testing.yml/badge.svg)](https://github.com/wp-cli/wp-cli/actions/workflows/testing.yml) [![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/wp-cli/wp-cli.svg)](https://isitmaintained.com/project/wp-cli/wp-cli "Average time to resolve an issue") [![Percentage of issues still open](https://isitmaintained.com/badge/open/wp-cli/wp-cli.svg)](https://isitmaintained.com/project/wp-cli/wp-cli "Percentage of issues still open")
7+
[WP-CLI](https://wp-cli.org/) 是一款用于管理 [WordPress](https://wordpress.org/) 的命令行界面,无需浏览器即可完成插件更新、多站点设置等操作。
8+
9+
持续的维护是通过以下方式实现的:
10+
11+
<div style="
12+
display: flex;
13+
flex-wrap: wrap;
14+
align-items: center;
15+
justify-content: space-between;
16+
text-align: center;">
17+
<a href="https://automattic.com/" style="width:49%; margin-bottom: 10px">
18+
<img src="https://make.wordpress.org/cli/files/2017/04/automattic-1.png" alt="Automattic" width="320" height="70" style="height: auto" />
19+
</a>
20+
<a href="https://www.bluehost.com/" style="width:49%; margin-bottom: 10px">
21+
<img style="height: auto" src="https://make.wordpress.org/cli/files/2017/04/bluehost.png" alt="Bluehost" width="320" height="52" />
22+
</a>
23+
<a href="https://pantheon.io/" style="width:49%; margin-bottom: 10px">
24+
<img style="height: auto" src="https://make.wordpress.org/cli/files/2019/06/pantheon.png" alt="Pantheon" width="320" height="100" />
25+
</a>
26+
<a href="https://www.siteground.com/" style="width:49%; margin-bottom: 10px">
27+
<img style="height: auto" src="https://make.wordpress.org/cli/files/2019/06/SG_logo.png" alt="SiteGround" width="320" height="66" />
28+
</a>
29+
<a href="https://wpengine.com/" style="width:49%; margin-bottom: 10px">
30+
<img style="height: auto" src="https://make.wordpress.org/cli/files/2017/04/wpengine.png" alt="WP Engine" width="320" height="60" />
31+
</a>
32+
<a href="https://www.cloudways.com/" style="width:49%; margin-bottom: 10px">
33+
<img style="height: auto" src="https://make.wordpress.org/cli/files/2021/02/Cloudways-Logo-e1612285267691.png" alt="Cloudways" width="320" height="62" />
34+
</a>
35+
</div>
36+
37+
目前的稳定版本是 [2.5.0](https://make.wordpress.org/cli/2021/05/19/wp-cli-v2-5-0-release-notes/)。如果您想获取最新信息,请在 Twitter 上关注 [@wpcli](https://twitter.com/wpcli) 或者 [订阅邮件通知](https://make.wordpress.org/cli/subscribe/)。参阅 [产品路线图](https://make.wordpress.org/cli/handbook/roadmap/) 了解未来版本的更新规划。
38+
39+
[![Testing](https://github.com/wp-cli/automated-tests/actions/workflows/testing.yml/badge.svg)](https://github.com/wp-cli/automated-tests/actions/workflows/testing.yml) [![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/wp-cli/wp-cli.svg)](https://isitmaintained.com/project/wp-cli/wp-cli "Average time to resolve an issue") [![Percentage of issues still open](https://isitmaintained.com/badge/open/wp-cli/wp-cli.svg)](https://isitmaintained.com/project/wp-cli/wp-cli "Percentage of issues still open")
1640

1741
导航链接:[使用](#使用) &#124; [安装](#安装) &#124; [支持](#支持) &#124; [扩展](#扩展) &#124; [贡献](#贡献) &#124; [参考](#参考)
1842

1943
## 使用
2044

21-
WP-CLI 可以为您在 WordPress 后台管理中执行的许多操作提供命令行工具。例如,使用 `wp plugin install --activate`[说明文档](https://developer.wordpress.org/cli/commands/plugin/install/))安装并激活插件
45+
WP-CLI 为您在 WordPress 后台管理中的许多操作提供了一个命令行接口。例如,使用 `wp plugin install --activate`([说明文档](https://developer.wordpress.org/cli/commands/plugin/install/)) 安装并激活一个 WordPress 插件
2246

2347
```bash
2448
$ wp plugin install user-switching --activate
@@ -41,7 +65,7 @@ Success: 34 transients deleted from the database.
4165

4266
有关如何使用 WP-CLI 的更多内容请阅读《[Quick Start](https://make.wordpress.org/cli/handbook/quick-start/)》。您也可以在 [Shell Friends](https://make.wordpress.org/cli/handbook/shell-friends/) 了解实用的命令行工具。
4367

44-
如果您已经熟悉基本命令,可以到 [WP-CLI Commands](https://developer.wordpress.org/cli/commands/) 了解更多有关主题及插件管理、数据导入与导出和数据库操作的内容
68+
如果已经熟悉基本命令,可以到 [WP-CLI Commands](https://developer.wordpress.org/cli/commands/) 了解更多有关主题及插件管理、数据导入与导出以及数据库操作的内容
4569

4670
## 安装
4771

@@ -53,13 +77,13 @@ Success: 34 transients deleted from the database.
5377
- PHP 5.6 或更高版本。
5478
- WordPress 3.7 或更高版本,较旧版本在功能上可能会有所减少。
5579

56-
再次检查操作环境,使用 `wget``curl` 下载 [wp-cli.phar](https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar)
80+
检查好了操作环境,使用 `wget``curl` 下载 [wp-cli.phar](https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar)
5781

5882
```bash
5983
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
6084
```
6185

62-
接下来,检查 Phar 文件确保其正常运行:
86+
然后,检查 Phar 文件确保其正常运行:
6387

6488
```bash
6589
php wp-cli.phar --info
@@ -72,42 +96,46 @@ chmod +x wp-cli.phar
7296
sudo mv wp-cli.phar /usr/local/bin/wp
7397
```
7498

75-
如果 WP-CLI 安装成功,使用 `wp --info` 命令,将看到以下输出信息
99+
如果 WP-CLI 安装成功,当您运行 `wp --info` 时,可以看到类似下面的回显
76100

77101
```bash
78102
$ wp --info
79-
OS: Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jan 11 22:59:40 PST 2018; root:xnu-3789.73.8~1/RELEASE_X86_64 x86_64
80-
Shell: /bin/zsh
81-
PHP binary: /usr/local/bin/php
82-
PHP version: 7.0.22
83-
php.ini used: /etc/local/etc/php/7.0/php.ini
84-
WP-CLI root dir: /home/wp-cli/.wp-cli/vendor/wp-cli/wp-cli
85-
WP-CLI vendor dir: /home/wp-cli/.wp-cli/vendor
103+
OS: Linux 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64
104+
Shell: /usr/bin/zsh
105+
PHP binary: /usr/bin/php
106+
PHP version: 8.0.5
107+
php.ini used: /etc/php/8.0/cli/php.ini
108+
MySQL binary: /usr/bin/mysql
109+
MySQL version: mysql Ver 8.0.23-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))
110+
SQL modes:
111+
WP-CLI root dir: /home/wp-cli/
112+
WP-CLI vendor dir: /home/wp-cli/vendor
113+
WP_CLI phar path:
86114
WP-CLI packages dir: /home/wp-cli/.wp-cli/packages/
87-
WP-CLI global config: /home/wp-cli/.wp-cli/config.yml
88-
WP-CLI project config:
89-
WP-CLI version: 2.4.0
115+
WP-CLI global config:
116+
WP-CLI project config: /home/wp-cli/wp-cli.yml
117+
WP-CLI version: 2.5.0
90118
```
91119

92-
### 更新 WP-CLI
120+
### 更新
93121

94-
如果需要更新 WP-CLI ,可以运行 `wp cli update`[说明文档](https://developer.wordpress.org/cli/commands/cli/update/))或者重复上述安装方法。
122+
您可以用 `wp cli update`[说明文档](https://developer.wordpress.org/cli/commands/cli/update/)更新 WP-CLI,或者重复上述安装方法。
95123

96-
如果 WP-CLI 的所有者是 root 或其他系统管理员,则需要执行 `sudo wp cli update` 操作。
124+
如果 WP-CLI 是由 root 或其他系统用户拥有,则需要执行 `sudo wp cli update` 操作。
97125

98126
如果您想体验最新版本,可以运行 `wp cli update --nightly` 来安装最新的 Nightly Builds 版本(每天更新的版本,不要用到生产环境) WP-CLI 工具。该版本在开发环境中有一定的稳定性,并且始终包含最新和最出色的 WP-CLI 功能。
99127

100128
### Tab 命令行补全
101129

102-
WP-CLI 带有用于 Bash 和 ZSH 的命令行补全脚本。下载 [wp-completion.bash](https://raw.githubusercontent.com/wp-cli/wp-cli/v2.4.0/utils/wp-completion.bash) `~/.bash_profile` 加载它即可。例如:
130+
WP-CLI 带有用于 Bash 和 ZSH 的命令行补全脚本。下载 [wp-completion.bash](https://raw.githubusercontent.com/wp-cli/wp-cli/v2.5.0/utils/wp-completion.bash) 并在 `~/.bash_profile` 中加载即可,例如:
103131

104132
```bash
105133
source /FULL/PATH/TO/wp-completion.bash
106134
```
107135

108-
在此之后不要忘记运行 `source ~/.bash_profile`
136+
然后运行 `source ~/.bash_profile` 使其生效.
109137

110-
对于 ZSH,您可能需要在加载 `bashcompinit` 后加载 `wp-completion.bash`将以下内容放入您的 `.zshrc`
138+
如果使用 zsh,需要在加载 `bashcompinit` 后载入 `wp-completion.bash`将下面的内容放入 `.zshrc` 中即可
111139

112140
```bash
113141
autoload bashcompinit
@@ -196,7 +224,7 @@ WP-CLI 项目维护者: [schlessera](http://github.com/schlessera)。
196224

197225
## 参考
198226

199-
除了 [composer.json](https://wp-cli.org/composer.json) 中定义的库之外,我们还使用了下面项目中的代码或思想
227+
除了 [composer.json](https://wp-cli.org/composer.json) 中定义的库之外,我们还使用了以下项目的代码或想法
200228

201229
* [Drush](https://github.com/drush-ops/drush) 用于很多事情
202230
* [wpshell](https://code.trac.wordpress.org/browser/wpshell) 用于 `wp shell`

0 commit comments

Comments
 (0)