diff options
Diffstat (limited to 'src/application/fetch-mime-types.php')
-rw-r--r-- | src/application/fetch-mime-types.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/application/fetch-mime-types.php b/src/application/fetch-mime-types.php new file mode 100644 index 0000000..2e49726 --- /dev/null +++ b/src/application/fetch-mime-types.php @@ -0,0 +1,22 @@ +<?php + +if (PHP_SAPI !== "cli") { + http_response_code(400); + echo "This script must be run from the command line"; + exit; +} + +$input = "https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types"; +$output = __DIR__ . "/assets/mimetypes"; + +$hInput = fopen($input, "r") or die("Failed to open input file"); +$hOutput = fopen($output, "w") or die("Failed to open output file"); + +while (($ln = fgets($hInput)) !== false) { + if (strpos($ln, "#") === 0) + continue; + fputs($hOutput, $ln); +} + +fclose($hInput); +fclose($hOutput); |