Skip to content

Commit

Permalink
Add ignore-files argument for core verify-checksums command (wp-cli#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
john-f-chamberlain authored and John Chamberlain committed Jun 7, 2024
1 parent f691199 commit 9ab2bde
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Checksum_Core_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class Checksum_Core_Command extends Checksum_Base_Command {
*/
private $include_root = false;

private $ignored_files = [];

/**
* Verifies WordPress files against WordPress.org's checksums.
*
Expand Down Expand Up @@ -83,6 +85,10 @@ public function __invoke( $args, $assoc_args ) {
$this->include_root = true;
}

if ( ! empty ($assoc_args['ignore-files'] ) ) {
$this->ignored_files = array_map('trim', explode(',', $assoc_args['ignore-files']));
}

if ( empty( $wp_version ) ) {
$details = self::get_wp_details();
$wp_version = $details['wp_version'];
Expand All @@ -107,6 +113,11 @@ public function __invoke( $args, $assoc_args ) {

$has_errors = false;
foreach ( $checksums as $file => $checksum ) {
// Skip ignored files
if ( in_array($file, $this->ignored_files ) ) {
continue;
}

// Skip files which get updated
if ( 'wp-content' === substr( $file, 0, 10 ) ) {
continue;
Expand Down

0 comments on commit 9ab2bde

Please sign in to comment.