Skip to content

Commit

Permalink
fix: changed to comma separated, added readme
Browse files Browse the repository at this point in the history
  • Loading branch information
iDschepe committed Jun 13, 2024
1 parent fc021e0 commit 4013dc4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This package implements the following commands:
Verifies WordPress files against WordPress.org's checksums.

~~~
wp core verify-checksums [--include-root] [--version=<version>] [--locale=<locale>] [--insecure]
wp core verify-checksums [--include-root] [--version=<version>] [--locale=<locale>] [--insecure] [--exclude=<files>]
~~~

Downloads md5 checksums for the current version from WordPress.org, and
Expand All @@ -43,6 +43,9 @@ site.
[--insecure]
Retry downloads without certificate validation if TLS handshake fails. Note: This makes the request vulnerable to a MITM attack.

[--exclude=<files>]
Exclude specific files from the checksum verification. Provide a comma-separated list of file paths.

**EXAMPLES**

# Verify checksums
Expand All @@ -64,7 +67,9 @@ site.
Warning: File doesn't verify against checksum: wp-config-sample.php
Error: WordPress installation doesn't verify against checksums.


# Verify checksums excluding specific files
$ wp core verify-checksums --exclude="wp-my-custom-file.php,readme.html"
Success: WordPress installation verifies against checksums.

### wp plugin verify-checksums

Expand Down
6 changes: 3 additions & 3 deletions features/checksum-core.feature
Original file line number Diff line number Diff line change
Expand Up @@ -237,23 +237,23 @@ Feature: Validate checksums for WordPress install
sample content of some file
"""

When I try `wp core verify-checksums --exclude='readme.html wp-includes/some-filename.php'`
When I try `wp core verify-checksums --exclude='readme.html,wp-includes/some-filename.php'`
Then STDERR should be empty
And STDOUT should be:
"""
Success: WordPress installation verifies against checksums.
"""
And the return code should be 0

Scenario: Verify core checksums with missing one excluded file
Scenario: Verify core checksums with missing excluded file
Given a WP install
And "WordPress" replaced with "PressWord" in the readme.html file
And a wp-includes/some-filename.php file:
"""
sample content of some file
"""

When I try `wp core verify-checksums --exclude=' wp-includes/some-filename.php'`
When I try `wp core verify-checksums --exclude='wp-includes/some-filename.php'`
Then STDERR should be:
"""
Warning: File doesn't verify against checksum: readme.html
Expand Down
6 changes: 3 additions & 3 deletions src/Checksum_Core_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Checksum_Core_Command extends Checksum_Base_Command {
* : Retry downloads without certificate validation if TLS handshake fails. Note: This makes the request vulnerable to a MITM attack.
*
* [--exclude=<files>]
* : Exclude specific files from the checksum verification. Provide a space-separated list of file paths.
* : Exclude specific files from the checksum verification. Provide a comma-separated list of file paths.
*
* ## EXAMPLES
*
Expand All @@ -75,7 +75,7 @@ class Checksum_Core_Command extends Checksum_Base_Command {
* Warning: File doesn't verify against checksum: wp-config-sample.php
* Error: WordPress installation doesn't verify against checksums.
*

Check failure on line 77 in src/Checksum_Core_Command.php

View workflow job for this annotation

GitHub Actions / code-quality / PHPCS

Whitespace found at end of line
* # Verify checksums
* # Verify checksums and exclude files

Check failure on line 78 in src/Checksum_Core_Command.php

View workflow job for this annotation

GitHub Actions / code-quality / PHPCS

Spaces must be used for mid-line alignment; tabs are not allowed
* $ wp core verify-checksums --exclude="readme.html"
* Success: WordPress installation verifies against checksums.
*
Expand All @@ -98,7 +98,7 @@ public function __invoke( $args, $assoc_args ) {
}

if ( ! empty( $assoc_args['exclude'] ) ) {
$this->exclude_files = explode( ' ', $assoc_args['exclude'] );
$this->exclude_files = explode( ',', Utils\get_flag_value( $assoc_args, 'exclude', '' ) );
}

if ( empty( $wp_version ) ) {
Expand Down

0 comments on commit 4013dc4

Please sign in to comment.