<?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);