HongPong / broken-link-checker

This plugin will check your posts, comments and other content for broken links and missing images, and notify you if any are found. (non-commercial community fork of broken-link-checker)
10 stars 4 forks source link

Override "HEAD" remote operations for individual or global link checks, to "GET" requests #31

Open HongPong opened 5 years ago

HongPong commented 5 years ago

in some cases a remote host may not give the same results for a HEAD request instead of a regular GET request.

per the discussion here @pathduck ran into this kind of issue with a remote host probably. https://wordpress.org/support/topic/help-sites-who-always-show-redirect/

This isn't a high priority for me and would probably be after #24 for ease of proper development, however I wanted to get the idea established.

Pathduck commented 5 years ago

Thanks for putting it up. And yeah, you might as well make that "edge cases" 😄

Pathduck commented 5 years ago

Maybe do a double-check of URLs that fail and give redirect status? First check with HEAD then if it fails with a redirect, do a quick GET (without getting the full page). Hopefully it wouldn't cause too much overhead if you do it this way - and less to code.

Pathduck commented 5 years ago

Hello again Dan, I was wondering, could you have a look at this commit:

https://github.com/Pathduck/broken-link-checker/commit/2e754a01d2a9b3b78375ad7b5dac0d6e30b52182

I think it could solve my issue, and I've been running it for over a week now on my site, with no problems as far as I can tell. But it's not very elegant, and could maybe be done differently without the massive conditional.

By the way, I've been trying to help some people out on the BLC forum from what I learned looking into this. But getting more and more frustrated with the original devs' complete absence. They just popped in, committed some pulls, and dropped out again, with no intent to help people with issues...

HongPong commented 5 years ago

This is cool, I like it. I think what I really need to do is get the travisCI stuff going, then can write tests to match the condition you cover here, and we can have a little more assurance that the condition works as expected.

I have for now withdrawn my request to take over the official plugin, since there is no real path to taking over the plugin if they maintain at least that level of engagement. I understand your perspective and sympathize with it - over in Drupal world the value system and control of modules is quite different so that generally speaking this kind of situation doesn't happen.

Pathduck commented 5 years ago

Thanks a lot Dan! I'm not 100% on how Git works but I think you would be able to pull this change into your repo if you wanted right? Or I can make another PR to this repo? You'd need to pull in the changes from the original master first I think.

I saw your post over at the support forum too, very well written. I'll be following developments with interest. And maybe try to help some folks with their seemingly endless Amazon.com affiliate link issues 😆

HongPong commented 5 years ago

Yes you should be able to generate a PR I think, or I could pick it off (the best process is for me to make another branch, pull your change onto it, then merge that into the main branch)

This whole thing is getting a little complicated - in that situation I would use GitKraken ( https://www.gitkraken.com/ -- also Atlassian Sourcetree does similar things) to visualize the difference between forks and commits more easily than trying to decode the change logs directly. Whether you are new or a grizzled veteran I find GitKraken is really helpful.

Ideally this kind of thing can be added with tests in a testing framework so that is what I would aim for - it's the best way to prevent regressions from happening, although we don't have it available within this project.

Pathduck commented 5 years ago

Yes, I have no idea how heavy Git users are able to get their head around all the different commands, branches, merges, and the apparent hundreds of ways of doing the same thing. You could spend literally several work-days just getting the CLI client set up like you want it... So a GUI client would be a must for any advanced use, even if the "hardcore" will scoff at it.

I used SVN several years ago and I liked it, but my work moved everything to Git and I've had a hard time getting my head around even the basics. I tried telling them "Git is for collaborative work by individuals who don't know each other, working far apart on the internet, not enterprise users with tight control of who works on what."

Oh well, my little protest didn't work, as could be expected 🙄

GitKraken looks like a good tool, I'll try to remember it (if I ever find a need) 👍