Happy release day!
We’re excited to bring you WP-CLI v1.4.0. In just two short months, we’ve merged 308 pull requests from 42 contributors.
New faces
You may have noticed a few new faces around the project. This is our motley crew of committers:
- Martin (@gitlost) lives in Dublin, Ireland. Check out his work with
wp db searchandwp search-replace --log(see below). - Siddharth (@Sidsector9) resides in Pune, India. His enhancements to
wp doctorandwp profilewill be available soon in a release near you. - Takayuki (@miya0001) is based out of Kyoto, Japan. He’s been making numerous improvements across the entire project; you never know what his next pull request will fix.
They’ve already had an amazing impact on the project. Please pass along your thanks when you have the chance.
Log search-replace transformations
If you’ve ever wanted to see what transformations are taking place with wp search-replace, now you can!
Use wp search-replace --log to display transformations as they happen, or wp search-replace --log=transformations.log to save the transformations to a file [#35, #39]:
$ wp search-replace 'http://' 'https://' --log
wp_options.option_value:1
< http://wordpress-develop.dev
> https://wordpress-develop.dev
wp_options.option_value:2
< http://wordpress-develop.dev
> https://wordpress-develop.dev
+------------+--------------+--------------+------+
| Table | Column | Replacements | Type |
+------------+--------------+--------------+------+
| wp_options | option_value | 3 | PHP |
+------------+--------------+--------------+------+
Success: Made 3 replacements.
It’s even more beautiful in color. Check out this asciicinema video for the full glory.
Note: wp search-replace is much slower when logging transformations, so please use it wisely.
See registered image sizes
Does uploading a new image take forever? You might have too many registered image sizes!
Both themes and plugins make use of add_image_size() [ref] to define names for image sizes they expect to use in templating. For each registered image size with a hard crop, WordPress has to create the cropped version on upload. With dozens of image sizes, uploading an image can take tens of seconds.
Use wp media image-size to see all of the image sizes registered to WordPress [#36, #37, #39, #49]:
$ wp media image-size --format=count
55
55 is too many!
Everything else in v1.4.0
New and notable
wp cli has-command: Detect whether a command is registered [#4349].wp site (mature|unmature|public|unpublic): Managematureandpublicstatus of a site [#63].wp * (pluck|patch): Fetch and modify serialized data in options and meta [#24, #65].wp user (spam|unspam): Mark a user as spam or not spam [#74, #86, #90].
Command improvements
comment list:- Improves performance of
--format=count[#64].
- Improves performance of
core download:core update:- Makes use of
halt_on_errorto catch error and release lock [#38].
- Makes use of
db export:- Includes
Y-m-din default export file name [#36].
- Includes
db search:- Caters for reserved word column/table names [#40].
- Changes default delimiter to
chr(1)[#46]. - Fixes match in non-regex case [#45].
- Lessens context duplication by shortening and appending context if it overlaps with the next match [#55].
- Avoids displaying default delimiter on regex fail in db search [#56].
export:import:- Avoids use of
GLOB_BRACEfor compatibility with Alpine Linux [#14].
- Avoids use of
media import:media regenerate:- Skips non-thumbnailed PDFs & other images rather than fail [#48].
package browse:- Adds deprecation notice [#36].
package install:- Supports package names that differ from repository names [#31].
package (install|uninstall):- Only includes Composer return code when it’s set [#40].
package uninstall:- Removes repository entry when uninstalling [#37].
plugin install:- Skips renaming ZIPs coming from a GitHub archive release/tag [#45].
plugin list:plugin search:- Only displays pagination message when
--format=table[#56].
- Only displays pagination message when
scaffold child-theme:- Transforms spaces to underscores when scaffolding a child theme [#40].
scaffold plugin:- Adds
package-lock.json,yarn.lockto distignore template [#57].
- Adds
scaffold plugin-tests:- Uses
$TMPDIRinbin/install-wp-tests.shto allow temp directory override [#39]. - Uses latest branch for test library in
bin/install-wp-tests.sh, and always gets the latest major release when 2 digit WP versions are used [#35]. - Removes XDebug in scaffolded
.travis.ymlto improve performance [#49]. - Improves error message when
phpunitis run beforebin/install-wp-tests.sh[#55]. - Shows progress when invoking
phpcs[#64]. - Adds PHP 7.0 and 7.1 to scaffolded GitLab configuration [#68].
- Uses
scaffold (post-type|taxonomy):search-replace:- Adds
esc_sql_ident()function to escape column/table names [#23]. - Adds
--regex-delimiterargument and validation for the--regex-flagsargument [#28, #29, #30]. - Adds
--reportflag so report can be suppressed with--no-report;--report-changed-onlyflag option to only report changed fields [#32]. - Avoids displaying default delimiter on regex failure [#40].
- Adds
site delete:- Prevent deleting the root site on multisite, which WordPress core doesn’t permit [#73].
user import-csv:- Permits importing CSV from STDIN [#100].
Framework enhancements
- Brings codebase inline with WordPress Coding Standards while narrowly avoiding committer mutiny [#4058].
- Improves AutoloadSplitter regexes [#4422].
- Add skips argument to
WP_CLI\Utils\report_batch_operation_results()[#4429]. - Provides dictionary-based suggestions for common misspellings [#4392].
- Introduces new ‘halt_on_error’ to overload exit in
WP_CLI\Utils\http_request()[#4383]. - When extracting, fails back to
tar xzwhenPharDatathrows an Exception [#4371]. - Adds support for running commands over
vagrant ssh[#4348]. - Supports upper- and lowercase ‘Y’ when prompting a flag [#4334].
- Gives suggestions when exiting early on
wp help[#4266, #4303].
Contributors to this release (42 total): aaemnnosttv, AaronRutley, ako80218, anhskohbo, atimmer, BhargavBhandari90, danielbachhuber, desrosj, diggy, domantasg, drzraf, eliseferguson, ethanclevenger91, Flimm, fumikito, GaryJones, gitlost, goldenapples, hearvox, Ippey, javorszky, jdub233, johnbillion, kurudrive, Lewiscowles1986, mimosafa, mitchelldmiller, mitraval192, miya0001, n8finch, nameherocom, nextgenthemes, ryotsun, schlessera, shadyvb, Sidsector9, stevegrunwell, szepeviktor, takezou, Umangvaghela, waviaei, wp-make-coffee