}
set_time_limit(0);
header('Content-Type: text/plain');
if (isset($_SERVER['argv'][1]) && preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/u', $_SERVER['argv'][1]) > 0) {
    $modified_date = $_SERVER['argv'][1];
} else {
    if (isset($_GET['date']) && preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/u', $_GET['date']) > 0) {
        $modified_date = $_GET['date'];
    }
}
if (isset($modified_date)) {
    if (git_mysql_prepare_table()) {
        if (!isset($_GET['output'])) {
            echo "Fetching GIT Log Data...\n";
        }
        if (($git_log_temp_file = get_git_log_data($modified_date)) !== false) {
            if (!isset($_GET['output'])) {
                echo "Parsing GIT Log Data...\n";
            }
            if (!git_mysql_parse($git_log_temp_file)) {
                echo "Error while fetching or parsing GIT log contents\n";
                exit;
            }
        } else {
            echo "Error while fetching GIT log\n";
            exit;
        }
        if (isset($_SERVER['argv'][2]) && strlen(trim($_SERVER['argv'][2])) > 0) {
            $output_log_filename = trim($_SERVER['argv'][2]);
            echo "Generating Change Log. Saving to {$output_log_filename}\n";
            git_mysql_output_log($output_log_filename);
}
set_time_limit(0);
header('Content-Type: text/plain');
if (isset($_SERVER['argv'][1]) && preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/u', $_SERVER['argv'][1]) > 0) {
    $modified_date = $_SERVER['argv'][1];
} else {
    if (isset($_GET['date']) && preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/u', $_GET['date']) > 0) {
        $modified_date = $_GET['date'];
    }
}
if (isset($modified_date)) {
    if (git_mysql_prepare_table()) {
        if (!isset($_GET['output'])) {
            echo "Fetching GIT Log Data...\n";
        }
        if ($git_log_temp_file = get_git_log_data($modified_date)) {
            if (!isset($_GET['output'])) {
                echo "Parsing GIT Log Data...\n";
            }
            if (!git_mysql_parse($git_log_temp_file)) {
                echo "Error while fetching or parsing GIT log contents\n";
                exit;
            }
        } else {
            echo "Error while fetching GIT log\n";
            exit;
        }
        if (isset($_SERVER['argv'][2]) && strlen(trim($_SERVER['argv'][2])) > 0) {
            $output_log_filename = trim($_SERVER['argv'][2]);
            echo "Generating Change Log. Saving to {$output_log_filename}\n";
            git_mysql_output_log($output_log_filename);