OSDN Git Service

need sudo for pear config-set too
[wvm/wvm.git] / README.md
1 What is wp-cli?
2 --------------
3
4 A set of tools for controlling WordPress installations from the command line.
5
6 Requirements
7 ------------
8
9 * PHP >= 5.3
10 * WP >= 3.3
11
12 Installing
13 ----------
14
15 **Via PEAR:**
16
17 ```sh
18 sudo pear config-set auto_discover 1
19 sudo pear install wp-cli.github.com/pear/wpcli
20 ```
21
22 **Via GIT:**
23
24 ```sh
25 git clone --recursive git://github.com/wp-cli/wp-cli.git ~/git/wp-cli
26 cd ~/git/wp-cli
27 sudo utils/dev-build
28 ```
29
30 You can replace `~/git/wp-cli` with whatever you want.
31
32
33 Using
34 -----
35
36 Go into a WordPress root folder:
37
38 ```
39 cd /var/www/wp/
40 ```
41
42 Typing `wp help` should show you an output similar to this:
43
44 ```
45 Example usage:
46         wp google-sitemap [build|help] ...
47         wp core [update|help] ...
48         wp home [help] ...
49         wp option [add|update|delete|get|help] ...
50         wp plugin [status|activate|deactivate|install|delete|update|help] ...
51         wp theme [status|details|activate|help] ...
52 ```
53
54 So this tells us which commands are installed: eg. google-sitemap, core, home, ...
55 Between brackets you can see their sub commands. 
56
57 Let's for example try to install the hello dolly plugin from wordpress.org:
58
59 ```
60 wp plugin install hello-dolly
61 ```
62
63 Output:
64
65 ```
66 Installing Hello Dolly (1.5)
67
68 Downloading install package from http://downloads.WordPress.org/plugin/hello-dolly.1.5.zip ...
69 Unpacking the package ...
70 Installing the plugin ...
71
72 Success: The plugin is successfully installed
73 ```
74
75 Multisite
76 ---------
77
78 On a multisite installation, you need to pass a --blog parameter, so that WP knows which site it's supposed to be operating on:
79
80 ```
81 wp theme status --blog=localhost/wp/test
82 ```
83
84 If you have a subdomain installation, it would look like this:
85
86 ```
87 wp theme status --blog=test.example.com
88 ```
89
90 If you're usually working on the same site most of the time, you can put the url of that site in a file called 'wp-cli-blog' in your root WP dir:
91
92 ```
93 echo 'test.example.com' > wp-cli-blog
94 ```
95
96 Then, you can call `wp` without the --blog parameter again:
97
98 ```
99 wp theme status
100 ```
101
102 Adding commands
103 ---------------
104
105 Adding commands to wp-cli is very easy. You can even add them from within your own plugin.
106 You can find more information about adding commands in the [Commands Cookbook](https://github.com/wp-cli/wp-cli/wiki/Commands-Cookbook) on our Wiki.
107
108 **Please share the commands you make, issue a pull request to get them included in wp-cli by default.**
109
110 Changelog
111 ---------------
112
113 **0.6**
114
115 - added `wp post` and `wp post-meta`
116 - added `wp user-meta`
117 - added `wp blog create`
118 - added `wp export`
119 - added `wp transient`
120 - added `wp db optimize` and `wp db repair`
121 - added `wp db create`, `wp db drop` and `wp db reset`
122 - added `wp db import`
123 - added `wp theme install` and `wp theme update`
124 - added `wp core install_network`
125 - added `wp core update_db`
126 - added `--json` option to several subcommands
127 - added `--network` option to `wp plugin activate`
128 - added `--require` global parameter
129 - fixed `wp plugin update`
130 - fixed "out of memory" error
131 - misc bugfixes and optimizations
132 - man pages (not in PEAR package)
133
134 **0.5**
135
136 - added `wp user`
137 - added `wp core download`
138 - added `wp core config`
139 - added `wp plugin update --all`
140 - added `wp theme update`
141 - added `wp db import`
142 - added `--url` `--path` and `--user` global parameters
143 - various bugfixes
144
145 **0.4**
146
147 - added `wp eval` and `wp eval-file`
148 - added `wp export`
149 - added `wp core install`
150 - fixed `wp core update`
151 - added `--dev` flag to `wp plugin install`
152 - added `wp plugin uninstall`
153 - fixed `wp plugin install` and `wp plugin update`
154
155 **0.3**
156
157 - added `wp sql`
158 - improved `wp option`
159 - pear installer
160
161 **0.2**
162
163 - added multisite support
164 - improved `wp plugin` and `wp theme`
165 - added `wp generate`
166 - added `wp core version`
167 - added `wp --version`
168 - added bash completion script
169
170 **0.1**
171
172 - initial release
173
174 Contributors
175 ------------
176
177 - [Contributor list](https://github.com/wp-cli/wp-cli/contributors)
178 - [Contributor guide](https://github.com/wp-cli/wp-cli/wiki/Commands-Cookbook)