Skip to content

Commit 5da44c9

Browse files
Don't warn about .htaccess file when --include-root is used (#112)
* Don't warn about .htaccess file when --include-root is used * add .htaccess file to tests * update test output for htaccess
1 parent acda510 commit 5da44c9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

features/checksum-core.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ Feature: Validate checksums for WordPress install
147147

148148
Scenario: Verify core checksums when extra files are included in WordPress root and --include-root is passed
149149
Given a WP install
150+
And a .htaccess file:
151+
"""
152+
# BEGIN WordPress
153+
"""
150154
And a extra-file.php file:
151155
"""
152156
hello world
@@ -169,6 +173,10 @@ Feature: Validate checksums for WordPress install
169173
"""
170174
Warning: File should not exist: extra-file.php
171175
"""
176+
And STDERR should not contain:
177+
"""
178+
Warning: File should not exist: .htaccess
179+
"""
172180
And STDERR should not contain:
173181
"""
174182
Warning: File should not exist: wp-content/unknown-file.php

src/Checksum_Core_Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function __invoke( $args, $assoc_args ) {
151151
*/
152152
protected function filter_file( $filepath ) {
153153
if ( true === $this->include_root ) {
154-
return ( 1 !== preg_match( '/^(wp-config\.php$|wp-content\/)/', $filepath ) );
154+
return ( 1 !== preg_match( '/^(\.htaccess$|wp-config\.php$|wp-content\/)/', $filepath ) );
155155
}
156156

157157
return ( 0 === strpos( $filepath, 'wp-admin/' )

0 commit comments

Comments
 (0)