Skip to content

Warn when files prefixed with 'wp-' are included in WordPress root#28

Merged
schlessera merged 3 commits intowp-cli:masterfrom
marcochiesi:master
Jan 15, 2018
Merged

Warn when files prefixed with 'wp-' are included in WordPress root#28
schlessera merged 3 commits intowp-cli:masterfrom
marcochiesi:master

Conversation

@marcochiesi
Copy link
Contributor

Fixes #13

This modification will check for files prefixed with wp- in the WordPress root folder, excluding wp-config.php, which of course is expected.
I used a regex (preg_match) to perform the check, and in particular:

  • (?!config\.php) excludes wp-config.php
  • ([^\/]*) excludes files in subfolders prefixed with wp-

I could have used a single preg_match also for the wp-includes and wp-admin folders, but strpos is more performant, and this way the preg_match is called only when both strpos calls return non-zero values. Also, this way the code is more readable.

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`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you include an extra update here?
I think that will only slow down the test and consume bandwidth, without any benefit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 schlessera added this to the 1.0.6 milestone Jan 13, 2018
@schlessera schlessera merged commit e7e6128 into wp-cli:master Jan 15, 2018
@schlessera
Copy link
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warn when files prefixed with 'wp-' are included in WordPress root

2 participants