Two new commands: doctor and profile

Excited to experiment with a couple new WP-CLI commands? wp doctor and wp profile are now available for everyone to install.

wp doctor lets you diagnose problems within WordPress by running a series of checks for symptoms. It includes an API for defining your own diagnosis, as well as writing custom checks.

$ wp @daniel doctor check --all
Running checks  100% [============================================================================================] 0:02 / 0:09
+----------------------------+---------+--------------------------------------------------------------------+
| name                       | status  | message                                                            |
+----------------------------+---------+--------------------------------------------------------------------+
| core-verify-checksums      | success | WordPress verifies against its checksums.                          |
| file-eval                  | success | All 'php' files passed check for 'eval\(.*base64_decode\(.*'.      |
| autoload-options-size      | success | Autoloaded options size (16.25kb) is less than threshold (900kb).  |
| constant-savequeries-falsy | success | Constant 'SAVEQUERIES' is undefined.                               |
| constant-wp-debug-falsy    | success | Constant 'WP_DEBUG' is defined falsy.                              |
| core-update                | success | WordPress is at the latest version.                                |
| cron-count                 | success | Total number of cron jobs is within normal operating expectations. |
| cron-duplicates            | success | All cron job counts are within normal operating expectations.      |
| option-blog-public         | success | Site is public as expected.                                        |
| plugin-active-count        | success | Number of active plugins (2) is less than threshold (80).          |
| plugin-deactivated         | success | Less than 40 percent of plugins are deactivated.                   |
| plugin-update              | success | Plugins are up to date.                                            |
| theme-update               | warning | 1 theme has an update available.                                   |
+----------------------------+---------+--------------------------------------------------------------------+

wp profile quickly identifies what’s slow with WordPress, by giving you visibility into key I/O indicators.

$ wp @daniel profile stage --fields=stage,time,cache_ratio
+------------+---------+-------------+
| stage      | time    | cache_ratio |
+------------+---------+-------------+
| bootstrap  | 0.2643s | 80%         |
| main_query | 0.0186s | 85.71%      |
| template   | 0.0489s | 93.71%      |
+------------+---------+-------------+
| total (3)  | 0.3318s | 86.47%      |
+------------+---------+-------------+

Both packages are in early stages of development — feedback welcome!