Skip to content

Commit

Permalink
Merge pull request #131 from wp-cli/dont-check-missing-files
Browse files Browse the repository at this point in the history
Plugin Checksums: Don't check missing files
  • Loading branch information
schlessera authored Nov 1, 2024
2 parents bc82cfb + dd2bbb6 commit d3d4a8c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
24 changes: 0 additions & 24 deletions features/checksum-plugin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ Feature: Validate checksums for WordPress plugins
"""
And STDERR should be empty

When I try `wp plugin verify-checksums duplicate-post --format=json --version=3.2.2`
Then the return code should be 1
And STDOUT should contain:
"""
"plugin_name":"duplicate-post","file":"duplicate-post-jetpack.php","message":"File is missing"
"""
And STDERR should be:
"""
Error: No plugins verified (1 failed).
"""

Scenario: Modified plugin doesn't verify
Given a WP install

Expand All @@ -50,19 +39,6 @@ Feature: Validate checksums for WordPress plugins
Error: No plugins verified (1 failed).
"""

When I run `rm wp-content/plugins/duplicate-post/duplicate-post.css`
Then STDERR should be empty

When I try `wp plugin verify-checksums duplicate-post --format=json`
Then STDOUT should contain:
"""
"plugin_name":"duplicate-post","file":"duplicate-post.css","message":"File is missing"
"""
And STDERR should be:
"""
Error: No plugins verified (1 failed).
"""

When I run `touch wp-content/plugins/duplicate-post/additional-file.php`
Then STDERR should be empty

Expand Down
6 changes: 0 additions & 6 deletions src/Checksum_Plugin_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,6 @@ public function __invoke( $args, $assoc_args ) {

$files = $this->get_plugin_files( $plugin->file );

foreach ( $checksums as $file => $checksum_array ) {
if ( ! in_array( $file, $files, true ) ) {
$this->add_error( $plugin->name, $file, 'File is missing' );
}
}

foreach ( $files as $file ) {
if ( ! array_key_exists( $file, $checksums ) ) {
$this->add_error( $plugin->name, $file, 'File was added' );
Expand Down

0 comments on commit d3d4a8c

Please sign in to comment.