Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add icw cli command to fix insecure content URLs #39

Merged
merged 3 commits into from
Apr 26, 2021

Conversation

thrijith
Copy link
Member

Description of the Change

Adds support for fixing insecure content URLs via WP-CLI

Benefits

  • Allows updating multiple posts / all posts in one go.

Verification Process

  • Test commands locally, make sure the URLs are updated in post content wherever possible, also verified with URLs that don't have an SSL version.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

Fixes #16

Changelog Entry

Add wp-cli command to fix insecure content in posts

@thrijith thrijith requested a review from jeffpaul March 26, 2021 20:22
@thrijith thrijith added this to the 1.1.0 milestone Mar 26, 2021
Copy link
Contributor

@dinhtungdu dinhtungdu left a comment

Choose a reason for hiding this comment

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

@thrijith

I think we should add some args to filter the get post query. Some of them may be:

  • post_type
  • limit
  • offset

Besides, instead of passing multiple ids as arguments now, I think we should use --include with a comma-separated list to pass multiple ids.

@thrijith
Copy link
Member Author

thrijith commented Apr 9, 2021

@dinhtungdu please check again and let me know if something needs change, thanks!

Copy link
Contributor

@dinhtungdu dinhtungdu left a comment

Choose a reason for hiding this comment

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

Great update @thrijith! Just one more issue and this PR is ready to merge.

Running the default command on my test site with 20 posts, the counter doesn't look correct. Also, I expect the summary to be printed after the batch finished only, not during the process.

❯❯❯ wp icw fix
Checking post content...
No insecure content URL found in post 169
No insecure content URL found in post 157
Success: 0/1 insecure URLs fixed in post 140.
No insecure content URL found in post 126
No insecure content URL found in post 113
No insecure content URL found in post 108
No insecure content URL found in post 105
No insecure content URL found in post 100
No insecure content URL found in post 94
No insecure content URL found in post 90
No insecure content URL found in post 78
No insecure content URL found in post 76
No insecure content URL found in post 73
No insecure content URL found in post 71
No insecure content URL found in post 69
No insecure content URL found in post 54
Success: 0/1 insecure URLs fixed in post 25.
No insecure content URL found in post 1

@jeffpaul jeffpaul requested review from dkotter and removed request for jeffpaul April 13, 2021 15:40
@jeffpaul jeffpaul modified the milestones: 1.1.0, 1.0.0 Apr 14, 2021
@thrijith
Copy link
Member Author

Hi @dinhtungdu, have updated the command result display, please check again and let me know if it looks ok, thank you!

@jeffpaul jeffpaul added the type:enhancement New feature or request. label Apr 26, 2021
@jeffpaul jeffpaul merged commit 0907e3c into develop Apr 26, 2021
@jeffpaul jeffpaul deleted the feature/add-cli-command branch May 11, 2021 20:27
@dkotter dkotter mentioned this pull request Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New feature or request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI script to scan and replace
4 participants