Skip to content
Merged
Changes from 1 commit
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
18 changes: 15 additions & 3 deletions src/Checksum_Core_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class Checksum_Core_Command extends Checksum_Base_Command {
*
* ## OPTIONS
*
* [--include-root]
* : Verify all files in the root directory.
*
* [--version=<version>]
* : Verify checksums against a specific version of WordPress.
*
Expand Down Expand Up @@ -58,8 +61,9 @@ class Checksum_Core_Command extends Checksum_Base_Command {
* @when before_wp_load
*/
public function __invoke( $args, $assoc_args ) {
$wp_version = '';
$locale = '';
$wp_version = '';
$locale = '';
$this->include_root = false;

if ( ! empty( $assoc_args['version'] ) ) {
$wp_version = $assoc_args['version'];
Expand All @@ -69,6 +73,10 @@ public function __invoke( $args, $assoc_args ) {
$locale = $assoc_args['locale'];
}

if ( ! empty( $assoc_args['include-root'] ) ) {
$this->include_root = true;
}

if ( empty( $wp_version ) ) {
$details = self::get_wp_details();
$wp_version = $details['wp_version'];
Expand Down Expand Up @@ -135,7 +143,11 @@ public function __invoke( $args, $assoc_args ) {
*
* @return bool
*/
protected function filter_file( $filepath ) {
protected function filter_file( $filepath, $include_root = false ) {
if ( true === $this->include_root ) {
return true;
}

return ( 0 === strpos( $filepath, 'wp-admin/' )
|| 0 === strpos( $filepath, 'wp-includes/' )
|| 1 === preg_match( '/^wp-(?!config\.php)([^\/]*)$/', $filepath )
Expand Down