From 27de098c78fbe60449a82caebf66fd2ea0a2f462 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Tue, 24 Jan 2023 15:32:49 -0800 Subject: [PATCH] Use `DIRECTORY_SEPARATOR` to fix detection on Windows (#67) --- src/Find_Command.php | 72 ++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/Find_Command.php b/src/Find_Command.php index a5f5e14..ed17859 100644 --- a/src/Find_Command.php +++ b/src/Find_Command.php @@ -12,48 +12,48 @@ class Find_Command { */ private $ignored_paths = [ // System directories - '/__MACOSX/', + '__MACOSX/', // Webserver directories - '/cache/', - '/caches/', - '/logs/', - '/debuglogs/', - '/Maildir/', - '/tmp/', + 'cache/', + 'caches/', + 'logs/', + 'debuglogs/', + 'Maildir/', + 'tmp/', // Generic application directories - '/configs/', - '/config/', - '/data/', - '/uploads/', - '/themes/', - '/plugins/', - '/modules/', - '/assets/', - '/thumbs/', - '/thumb/', - '/albums/', - '/attachments/', - '/js/', - '/pdf/', - '/releases/', - '/filestore/', + 'configs/', + 'config/', + 'data/', + 'uploads/', + 'themes/', + 'plugins/', + 'modules/', + 'assets/', + 'thumbs/', + 'thumb/', + 'albums/', + 'attachments/', + 'js/', + 'pdf/', + 'releases/', + 'filestore/', // Backup directories - '/backup/', - '/backups/', - '/mysql_backups/', - '/updater_backup/', + 'backup/', + 'backups/', + 'mysql_backups/', + 'updater_backup/', // Other applications - '/owncloud/', + 'owncloud/', // Dependency management - '/node_modules/', - '/bower_components/', - '/vendor/', - '/svn/', + 'node_modules/', + 'bower_components/', + 'vendor/', + 'svn/', // Directory for a common script kiddie hack - '/coockies/', + 'coockies/', // Already in a WordPress install - '/wp-admin/', - '/wp-content/', + 'wp-admin/', + 'wp-content/', ]; /** @@ -252,7 +252,7 @@ private function recurse_directory( $path ) { // This looks like a wp-includes directory, so check if it has a // version.php file. - if ( '/wp-includes/' === substr( $path, -13 ) + if ( DIRECTORY_SEPARATOR . 'wp-includes/' === substr( $path, -13 ) && file_exists( $path . 'version.php' ) ) { $version_path = $path . 'version.php'; $wp_path = substr( $path, 0, -13 );