forked from PocketMine/Crash-Archive
/
tools.php
34 lines (28 loc) · 819 Bytes
/
tools.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/*
*
*** PocketMine-MP Crash Archive ***
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
define("ARCHIVE_ROOT", realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
if(php_sapi_name() !== "cli"){
exit();
}
require_once("src/config.php");
require_once("src/Database.php");
$db = new Database();
if($argv[1] === "delete"){
$reportId = (int) $argv[2];
$db->runQuery("DELETE FROM crash_report WHERE id = $reportId;");
unlink("reports/". sha1($reportId . SECRET_SALT) . ".log");
echo "Report $reportId deleted!\n";
}