Warn when files prefixed with 'wp-' are included in WordPress root#28
Merged
schlessera merged 3 commits intowp-cli:masterfrom Jan 15, 2018
Merged
Warn when files prefixed with 'wp-' are included in WordPress root#28schlessera merged 3 commits intowp-cli:masterfrom
schlessera merged 3 commits intowp-cli:masterfrom
Conversation
schlessera
requested changes
Jan 13, 2018
features/checksum-core.feature
Outdated
| Scenario: Verify core checksums when extra files prefixed with 'wp-' are included in WordPress root | ||
| Given a WP install | ||
|
|
||
| When I run `wp core update` |
Member
There was a problem hiding this comment.
Why did you include an extra update here?
I think that will only slow down the test and consume bandwidth, without any benefit.
Contributor
Author
There was a problem hiding this comment.
You're right. Sorry, I just copied and pasted from the previous test, and I didn't notice it was not needed. I am going to fix it.
schlessera
approved these changes
Jan 15, 2018
Member
|
Thanks for the PR, @marcochiesi ! |
schlessera
added a commit
that referenced
this pull request
Dec 23, 2021
Warn when files prefixed with 'wp-' are included in WordPress root
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #13
This modification will check for files prefixed with
wp-in the WordPress root folder, excludingwp-config.php, which of course is expected.I used a regex (
preg_match) to perform the check, and in particular:(?!config\.php)excludeswp-config.php([^\/]*)excludes files in subfolders prefixed withwp-I could have used a single
preg_matchalso for thewp-includesandwp-adminfolders, butstrposis more performant, and this way thepreg_matchis called only when bothstrposcalls return non-zero values. Also, this way the code is more readable.