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

Remove WINNT check for argument processing #86

Open jamesjohnmcguire opened 4 years ago

jamesjohnmcguire commented 4 years ago

Change if (php_sapi_name() === 'cli' && PHP_OS != 'WINNT') { to if (php_sapi_name() === 'cli') {

Otherwise, the command line arguments are completely ignored on Windows.

At some points, you may want to check the OS, and not try some actions it is not capable of. However, at the very beginning of the script, I don't see the rationale. I have changed this on my local copy and it is working just fine, including the color support.

The color support might be working because of extensions I have installed. But even so, should not be merged with command line checking.

I tested only with 'file' and 'url' command line arguments.

vezaynk commented 4 years ago

Where are you running it to get colour support? I could never manage the standard cmd.exe to pick them up, so that is surprising to me.

I don't remember why I added the check there, I'll swift through the commits later to update as needed.

How does blacklist behave on Windows? If something were to break, it would be that.

jamesjohnmcguire commented 4 years ago

I just run it from a standard cmd.exe window. However, I installed ansicon (http://adoxa.altervista.org/ansicon/) on my path, which I think may be providing the color support. In any case, there are also various bash shells that run on Windows, such as the one that comes with git. the OS will still be winnt. So the checks may need to be more fine grained.

I didn't try anything about blacklist. If there is something quick to try, I can try.

The main thing, is to make sure the command line arguments are processed, even when running on windows.