Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
wp-cli/find-command
===================

Find WordPress installs on the filesystem.
Find WordPress installations on the filesystem.

[![Build Status](https://travis-ci.org/wp-cli/find-command.svg?branch=master)](https://travis-ci.org/wp-cli/find-command)

Expand All @@ -14,14 +14,14 @@ wp find <path> [--skip-ignored-paths] [--include_ignored_paths=<paths>] [--max_d
~~~

Recursively iterates subdirectories of provided `<path>` to find and
report WordPress installs. A WordPress install is a wp-includes directory
with a version.php file.
report WordPress installations. A WordPress installation is a wp-includes
directory with a version.php file.

Avoids recursing some known paths (e.g. /node_modules/, hidden sys dirs)
to significantly improve performance.

Indicates depth at which the WordPress install was found, and its alias,
if it has one.
Indicates depth at which the WordPress installations was found, and its
alias, if it has one.

```
$ wp find ./
Expand Down Expand Up @@ -99,7 +99,7 @@ Once you've decided to commit the time to seeing your pull request through, [ple

## Support

Github issues aren't for general support questions, but there are other venues you can try: http://wp-cli.org/#support
Github issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support


*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.*
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wp-cli/find-command",
"description": "Find WordPress installs on the filesystem.",
"description": "Find WordPress installations on the filesystem.",
"type": "wp-cli-package",
"homepage": "https://github.com/wp-cli/finder-command",
"license": "MIT",
Expand Down
20 changes: 10 additions & 10 deletions features/find.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ Feature: Find WordPress installs on the filesystem
When I run `wp find {TEST_DIR} --field=version_path --verbose`
Then STDOUT should contain:
"""
Found WordPress install at '{TEST_DIR}/subdir1/wp-includes/version.php'
Found WordPress installation at '{TEST_DIR}/subdir1/wp-includes/version.php'
"""
And STDOUT should contain:
"""
Found WordPress install at '{TEST_DIR}/subdir2/wp-includes/version.php'
Found WordPress installation at '{TEST_DIR}/subdir2/wp-includes/version.php'
"""

When I run `wp find {TEST_DIR} --format=count`
Expand All @@ -41,11 +41,11 @@ Feature: Find WordPress installs on the filesystem
When I run `wp find {TEST_DIR} --field=version_path --verbose`
Then STDOUT should contain:
"""
Found WordPress install at '{TEST_DIR}/subdir1/wp-includes/version.php'
Found WordPress installation at '{TEST_DIR}/subdir1/wp-includes/version.php'
"""
And STDOUT should not contain:
"""
Found WordPress install at '{TEST_DIR}/subdir2/wp-includes/version.php'
Found WordPress installation at '{TEST_DIR}/subdir2/wp-includes/version.php'
"""
And STDOUT should contain:
"""
Expand Down Expand Up @@ -80,15 +80,15 @@ Feature: Find WordPress installs on the filesystem
When I run `wp find {TEST_DIR} --verbose`
Then STDOUT should contain:
"""
Found WordPress install at '{TEST_DIR}/subdir1/wp-includes/version.php'
Found WordPress installation at '{TEST_DIR}/subdir1/wp-includes/version.php'
"""
And STDOUT should contain:
"""
Found WordPress install at '{TEST_DIR}/sub/subdir2/wp-includes/version.php'
Found WordPress installation at '{TEST_DIR}/sub/subdir2/wp-includes/version.php'
"""
And STDOUT should contain:
"""
Found WordPress install at '{TEST_DIR}/sub/sub/subdir3/wp-includes/version.php'
Found WordPress installation at '{TEST_DIR}/sub/sub/subdir3/wp-includes/version.php'
"""

When I run `wp find {TEST_DIR} --format=count`
Expand All @@ -100,11 +100,11 @@ Feature: Find WordPress installs on the filesystem
When I run `wp find {TEST_DIR} --verbose --max_depth=2`
Then STDOUT should contain:
"""
Found WordPress install at '{TEST_DIR}/subdir1/wp-includes/version.php'
Found WordPress installation at '{TEST_DIR}/subdir1/wp-includes/version.php'
"""
And STDOUT should contain:
"""
Found WordPress install at '{TEST_DIR}/sub/subdir2/wp-includes/version.php'
Found WordPress installation at '{TEST_DIR}/sub/subdir2/wp-includes/version.php'
"""
And STDOUT should contain:
"""
Expand All @@ -120,7 +120,7 @@ Feature: Find WordPress installs on the filesystem
When I run `wp find {TEST_DIR} --verbose --max_depth=1`
Then STDOUT should contain:
"""
Found WordPress install at '{TEST_DIR}/subdir1/wp-includes/version.php'
Found WordPress installation at '{TEST_DIR}/subdir1/wp-includes/version.php'
"""
And STDOUT should contain:
"""
Expand Down
22 changes: 11 additions & 11 deletions src/Find_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,24 @@ class Find_Command {
private $resolved_aliases = array();

/**
* Found WordPress installs.
* Found WordPress installations.
*
* @var array
*/
private $found_wp = array();

/**
* Find WordPress installs on the filesystem.
* Find WordPress installations on the filesystem.
*
* Recursively iterates subdirectories of provided `<path>` to find and
* report WordPress installs. A WordPress install is a wp-includes directory
* with a version.php file.
* report WordPress installations. A WordPress installation is a wp-includes
* directory with a version.php file.
*
* Avoids recursing some known paths (e.g. /node_modules/, hidden sys dirs)
* to significantly improve performance.
*
* Indicates depth at which the WordPress install was found, and its alias,
* if it has one.
* Indicates depth at which the WordPress installations was found, and its
* alias, if it has one.
*
* ```
* $ wp find ./
Expand Down Expand Up @@ -192,9 +192,9 @@ public function __invoke( $args, $assoc_args ) {
}

$this->start_time = microtime( true );
$this->log( "Searching for WordPress installs in '{$path}'" );
$this->log( "Searching for WordPress installations in '{$path}'" );
$this->recurse_directory( $this->base_path );
$this->log( "Finished search for WordPress installs in '{$path}'" );
$this->log( "Finished search for WordPress installations in '{$path}'" );
$formatter = new \WP_CLI\Formatter( $assoc_args, array( 'version_path', 'version', 'depth', 'alias' ) );
$formatter->display_items( $this->found_wp );
}
Expand All @@ -209,7 +209,7 @@ private function recurse_directory( $path ) {
// Provide consistent trailing slashes to all paths
$path = rtrim( $path, '/' ) . '/';

// Don't recurse directories that probably don't have a WordPress install.
// Don't recurse directories that probably don't have a WordPress installation.
if ( ! $this->skip_ignored_paths ) {
// Assume base path doesn't need comparison
$compared_path = preg_replace( '#^' . preg_quote( $this->base_path ) . '#', '', $path );
Expand Down Expand Up @@ -242,7 +242,7 @@ private function recurse_directory( $path ) {
'depth' => $this->current_depth - 1,
'alias' => $alias,
);
$this->log( "Found WordPress install at '{$version_path}'" );
$this->log( "Found WordPress installation at '{$version_path}'" );
return;
}

Expand Down Expand Up @@ -271,7 +271,7 @@ private function recurse_directory( $path ) {
}

/**
* Get the WordPress version for the install, without executing the file.
* Get the WordPress version for the installation, without executing the file.
*/
private static function get_wp_version( $path ) {
$contents = file_get_contents( $path );
Expand Down