Skip to content

Commit

Permalink
Don't warn about a .maintenance file in the root directory (#114)
Browse files Browse the repository at this point in the history
* don't warn about .maintenance file

* fix: add tests for .maintenance
  • Loading branch information
paulschreiber authored Jul 3, 2023
1 parent b22bbf0 commit ae420d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions features/checksum-core.feature
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ Feature: Validate checksums for WordPress install
"""
# BEGIN WordPress
"""
And a .maintenance file:
"""
<?php
$upgrading = time();
"""
And a extra-file.php file:
"""
hello world
Expand All @@ -177,6 +182,10 @@ Feature: Validate checksums for WordPress install
"""
Warning: File should not exist: .htaccess
"""
And STDERR should not contain:
"""
Warning: File should not exist: .maintenance
"""
And STDERR should not contain:
"""
Warning: File should not exist: wp-content/unknown-file.php
Expand Down
2 changes: 1 addition & 1 deletion src/Checksum_Core_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function __invoke( $args, $assoc_args ) {
*/
protected function filter_file( $filepath ) {
if ( true === $this->include_root ) {
return ( 1 !== preg_match( '/^(\.htaccess$|wp-config\.php$|wp-content\/)/', $filepath ) );
return ( 1 !== preg_match( '/^(\.htaccess$|\.maintenance$|wp-config\.php$|wp-content\/)/', $filepath ) );
}

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

0 comments on commit ae420d8

Please sign in to comment.