Happy 2016! I thought you might enjoy a new WP-CLI WP-CLI is the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The project page is http://wp-cli.org/ https://make.wordpress.org/cli/ release before I dive into the RESTful CLI Command Line Interface. Terminal (Bash) in Mac, Command Prompt in Windows, or WP-CLI for WordPress. project.
Use wp cli update
to install v0.22.0, representing 137 resolved issues and pull requests. Here’s what’s new.
search-replace for love and profit
Last month, Pantheon generously sponsored 15 hours of my time to address some of the long-standing bugs in the backlog, and make a few substantial enhancements too.
Let’s start with the good stuff:
- Performance boost! Instead of running a MYSQL MySQL is a relational database management system. A database is a structured collection of data where content, configuration and other options are stored. https://www.mysql.com/. LIKE statement every 1000 rows, WP-CLI now just runs it once [#2304]. On a post meta Meta is a term that refers to the inside workings of a group. For us, this is the team that works on internal WordPress sites like WordCamp Central and Make WordPress. table of ~3.5 million rows where 75,610 rows were affected, this change improved execution time from 734.926s to 225.509s (3.3x faster).
- Use the
--export=<filename>
argument to create a SQL file of your transformed data, instead of making updates to the database [#2254]. This is a helpful feature when you want to prepare a database for a new environment without having to import and then run search-replace.
- Wildcards can be used in table names [#2233]. search-replace against just meta tables with
wp search-replace <old-string> <new-string> '*meta*'
. Note: the pattern needs to be quoted, as *
is a special character in Bash.
I also landed a number of search-replace bug fixes and minor enhancements:
- Recurses objects by default when replacing inside of serialized data [#2222]. Among other things, this ensures theme mods are transformed as expected. You can disable the behavior with
--no-recurse-objects
. But, if you do disable the behavior, I’d like to hear from you. I think this is an unnecessary option we could remove at a later date.
- Properly escapes quotes used in search or replace strings [#2230].
- Lets users know to flush their persistent object cache after a search-replace procedure is performed [#2236].
- Bails early when the replacement string is the same as the search string [#2235].
- Indicates execution time when running search/replace with
--verbose
[#2242].
- Prevents unnecessary calls to
$wpdb->update()
when there are no replacements to be made [#2245].
- Drops unnecessary
REGEXP
query when in regex mode [#2305].
Changes to supported versions
WP-CLI’s minimum supported WordPress version is now 3.7 [#2261].
We also officially support PHP PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. https://www.php.net/manual/en/preface.php. 7 [#2330].
Everything else in v0.22.0
Improvements to wp scaffold (plugin|plugin-tests)
:
- Makes Travis less noisy by only sending email notifications on the initial build failure for a branch [#2194].
- Plugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party header The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes. follows WordPress’ PHPDoc standards [#2197].
- Adds
.dist
extension to PHPUnit config file to permit overriding with a local config file [#2247]
- Parses
readme.txt
to find WordPress versions to use as Travis tested versions [#2255].
- Includes a default
.gitignore
[#2297].
New flags for existing commands:
wp core update --minor
to only perform minor updates [#2256].
wp (post|comment|user) meta delete <id> --all
to delete all meta values on a given object [#2265].
wp core update-db --dry-run
to see whether a database needs an upgrade [#2293].
wp media regenerate --only-missing
for faster performance on sites with lots of images where only a small number are missing sizes [#2292].
wp cron event run --all
to execute all registered cron events [#2323].
wp site empty --uploads
to empty a site and delete its uploads directory too [#2339].
wp core install --skip-email
to install without email notifications [#2345].
wp transient (get|set|delete) --network
to manage site transients [#2351].
Framework enhancements:
- Introduces
wp_version_compare()
when comparing WordPress versions [#2237]. SVN Apache Subversion (often abbreviated SVN, after its command name svn) is a software versioning and revision control system. Software developers use Subversion to maintain current and historical versions of files such as source code, web pages, and documentation. Its goal is to be a mostly compatible successor to the widely used Concurrent Versions System (CVS). WordPress core and the wordpress.org released code are all centrally managed through SVN. https://subversion.apache.org/. and Git Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny footprint with lightning fast performance. Most modern plugin and theme development is being done with this version control system. https://git-scm.com/. tags include -src
in $wp_version
, which
version_compare()
doesn’t like.
- Defers to the
$PAGER
environment variable when set [#2264].
- Introduces a
composer.lock
file to the project, to fix dependencies to specific hashes [#2280].
- Magically globalizes any new variables defined in wp-config.php, as they’re expected to be global [#2318].
- If a
--require=<file>
is missing, specifies the context of where the missing file is referenced for easier debugging [#2336].
- Use
mustangostang/spyc
instead of bundling our own copy [#2350]. The Spyc
class is still available in the global namespace.
- Introduces
WP_CLIUtilsget_temp_dir()
for safer temp directories [#2353].
Improvements to other commands:
- Includes
not_found
label when scaffolding a custom taxonomy A taxonomy is a way to group things together. In WordPress, some common taxonomies are category, link, tag, or post format. https://codex.wordpress.org/Taxonomies#Default_Taxonomies. [#2196].
- Permits installing remote plugin files without
.zip
in filename [#2193].
- Warns when adding a user as a super admin when the user is already a super admin [#2202].
- Uses
WP_CLI::log()
instead of WP_CLI::line()
in wp import
, so --quiet
flag is respected [#2234].
- Adds support to
wp db tables
for wildcard tables (e.g. *meta*
), --all-tables-with-prefix
, and --format=csv
[#2250].
- Improves error message when installing a plugin or theme and the resource isn’t found [#2253,#2267].
- Supports custom
wp export
filename formats with --filename_format=<format>
[#2230]
- Assumes db errors during
wp install
to be installation failures, and reports accordingly [#2337].
- Exposes plugin header details at runtime for
wp scaffold plugin
[#2338].
- Includes
ci/behat-tags.php
in wp scaffold package-tests
[#2342].
Bug fixes across the board:
- Lets
help
run early when WP is detected, but not installed (e.g. wp core config --help
) [#2190]. Bug was introduced in v0.20.0.
- When scaffolding a child theme A Child Theme is a customized theme based upon a Parent Theme. It’s considered best practice to create a child theme if you want to modify the CSS of your theme. https://developer.wordpress.org/themes/advanced-topics/child-themes/., creates a safe version of the parent theme slug for the child enqueue function [#2203]. Previously, if the parent slug included dashes, an invalid enqueue function would be scaffolded.
- Suppresses error notices when looking for
wp-config.php
and PHP’s open_basedir
is in effect [#2211].
- Fixes error notice in
WP_CLILoggersQuiet
[#2210].
- Fixes
all_items
label in custom post type WordPress can hold and display many different types of content. A single item of such a content is generally called a post, although post is also a specific post type. Custom Post Types gives your site the ability to have templated posts, to simplify the concept. scaffolding [#2213].
- Ensures
install-package-tests.sh
actually downloads the nightly WP-CLI Phar build, and not a redirect [#2214].
- Sets the
upload_space_check_disabled
to 1
when installing multisite Multisite is a WordPress feature which allows users to create a network of sites on a single WordPress installation. Available since WordPress version 3.0, Multisite is a continuation of WPMU or WordPress Multiuser project. WordPress MultiUser project was discontinued and its features were included into WordPress core.https://codex.wordpress.org/Create_A_Network. [#2238]. This mirrors core Core is the set of software required to run WordPress. The Core Development Team builds WordPress.’s behavior on new installs.
- Provides a more helpful message when image regeneration fails [#2239].
- Properly updates menu sub-item parent when parent is deleted [#2262].
- Stops prefixing rewrite rules with
index.php
when using wp rewrite structure
[#2279].
- Fixes typo in
wp transient set
synopsis [#2282].
- Restores
wp core verify-checksums
for non-US English locales [#2287]. Bug was introduced in v0.21.0.
- Switches to the readline library, when available, for better support of arrow keys using
--prompt
[#2325].
WP_CLIFormatter
properly checks for null values on objects [#2322].
- In
wp media import
, uses host instead of scheme to determine whether a file is remote or local, for Windows compatibility [#2324].
- Ensures updating a plugin with an invalid
--version=<version>
specified doesn’t delete the plugin [#2346].
Contributors to this release: 2ndkauboy, coreyworrell, danielbachhuber, davidleach, duncanjbrown, ernilambar, fjarrett, gilbitron, greg-1-anderson, iandunn, jjeaton, modelm, rodrigoprimo, ryanshoover, stevector, szepeviktor, tristanpenman, x1024
You can browse the full list of resolved issues on Github GitHub is a website that offers online implementation of git repositories that can easily be shared, copied and modified by other developers. Public repositories are free to host, private repositories require a paid subscription. GitHub introduced the concept of the ‘pull request’ where code changes done in branches by contributors can be reviewed and discussed before being merged be the repository owner. https://github.com/.