Example #1
0
    if (!is_dir("/var/crash")) {
        mkdir("/var/crash", 0750, true);
    }
    @file_put_contents("/var/crash/crashreport_header.txt", $crash_report_header);
    if (file_exists("/tmp/PHP_errors.log")) {
        copy("/tmp/PHP_errors.log", "/var/crash/PHP_errors.log");
    }
    exec("find /var/crash -type l -exec rm {} +");
    exec("/usr/bin/gzip /var/crash/*");
    $files_to_upload = glob("/var/crash/*");
    echo "<br/>";
    echo gettext("Uploading...");
    ob_flush();
    flush();
    if (is_array($files_to_upload)) {
        $resp = upload_crash_report($files_to_upload);
        array_map('unlink', glob("/var/crash/*"));
        // Erase the contents of the PHP error log
        fclose(fopen("/tmp/PHP_errors.log", 'w'));
        echo "<br/>";
        print_r($resp);
        echo "<p><a href=\"/\">" . gettext("Continue") . "</a>" . gettext(" and delete crash report files from local disk.") . "</p>";
    } else {
        echo "Could not find any crash files.";
    }
} else {
    if (gettext($_POST['Submit']) == "No") {
        array_map('unlink', glob("/var/crash/*"));
        // Erase the contents of the PHP error log
        fclose(fopen("/tmp/PHP_errors.log", 'w'));
        header("Location: /");
Example #2
0
            mkdir('/var/crash', 0750, true);
        }
        $email = trim($_POST['Email']);
        if (!empty($email)) {
            $crash_report_header .= "Email {$email}\n";
        }
        $desc = trim($_POST['Desc']);
        if (!empty($desc)) {
            $crash_report_header .= "Description\n\n{$desc}";
        }
        file_put_contents('/var/crash/crashreport_header.txt', $crash_report_header);
        @rename('/tmp/PHP_errors.log', '/var/crash/PHP_errors.log');
        @copy('/var/run/dmesg.boot', '/var/crash/dmesg.boot');
        exec('/usr/bin/gzip /var/crash/*');
        $files_to_upload = glob('/var/crash/*');
        $resp = upload_crash_report($files_to_upload, $user_agent);
        array_map('unlink', $files_to_upload);
    } elseif ($_POST['Submit'] == 'no') {
        array_map('unlink', glob('/var/crash/*'));
        @unlink('/tmp/PHP_errors.log');
    } elseif ($_POST['Submit'] == 'new') {
        /* force a crash report generation */
        $has_crashed = true;
    }
} else {
    /* if there is no user activity probe for a crash report */
    $has_crashed = get_crash_report(true) != '';
}
if ($has_crashed) {
    $crash_files = glob("/var/crash/*");
    $crash_reports['System Information'] = trim($crash_report_header);