vezaynk / Sitemap-Generator-Crawler

PHP script to recursively crawl websites and generate a sitemap. Zero dependencies.
https://www.bbss.dev
MIT License
241 stars 92 forks source link

Prevented `which xmllint` on Windows #51

Closed miguelantoniosantos closed 6 years ago

vezaynk commented 6 years ago

I feel like writing a CONTRIBUTING guide now.

This repository follows the issue-discussion-PR pattern.

May as well do an exception again. AFAIK, the which command does exist on Windows. What is the point of this? What bug(s) does it solve?

EDIT: I was wrong. Windows has a where command instead of which.

ghost commented 6 years ago

What happened with the windows when you run that original script? I think you can do the similar test with where on Windows, but I don't have a windows to test it with.

This should do the trick: $whichcommand = (PHP_OS == 'WINNT') ? 'where' : 'which';

vezaynk commented 6 years ago

I looked it up, and it looks like the which command is not present on Windows (replaced instead with where ).

Disabling a feature makes little sense if it can be made to work with minimal effort.

if (`which xmllint` || `where xmllint`)

I am not sure if this would even work. I only have access to windows machines on week days.

ghost commented 6 years ago

I can run it on GNU/Linux if you test it first on Window and make sure it works there.

miguelantoniosantos commented 6 years ago

Didn't knew about the wherecommand. I will test it out.

miguelantoniosantos commented 6 years ago

Both suggestions work but, in my opinion, its better only to execute one command than to test two of them.

ghost commented 6 years ago

OR test || only executes the left and if it fails, then it the right one, not both by default. The first test should be which as it sounds to me a bit pervert to run PHP on Windows :D

miguelantoniosantos commented 6 years ago

True, but we exist. xD

vezaynk commented 6 years ago

Sorry for the delays, college systems were a mess today. Will test it out tomorrow.