[BC] 自動更新対応完了
This commit is contained in:
+2
-55
@@ -7,64 +7,11 @@ const LOG_PATH = './log.txt';
|
||||
|
||||
$log_data = [];
|
||||
|
||||
exec ("(ps -Af | grep -e '^miteruzo' | grep 'python3 main.py') && (ps -Af | grep -e '^miteruzo' | grep 'obs')",
|
||||
exec (("(ps -Af | grep -e '^miteruzo' | grep 'python3 main.py')"
|
||||
. " && (ps -Af | grep -e '^miteruzo' | grep 'obs')"),
|
||||
$output, $exit_code);
|
||||
$available = $exit_code === 0;
|
||||
unset ($output, $exit_code);
|
||||
|
||||
$page = (int) ($_GET['p'] ?? 1);
|
||||
$length = (int) ($_GET['max'] ?? 20);
|
||||
$asc = ($_GET['asc'] ?? 0) != 0;
|
||||
$keyword = trim ($_GET['q'] ?? '');
|
||||
$escaped = ($_GET['escaped'] ?? 0) != 0;
|
||||
|
||||
$date_start = ($_GET['start'] ?? null) ?: null;
|
||||
$date_end = ($_GET['end'] ?? null) ?: null;
|
||||
|
||||
$f = fopen (LOG_PATH, 'r');
|
||||
|
||||
if ($f !== false)
|
||||
{
|
||||
while (($dt = fgetcsv ($f, 0, "\t")) !== false)
|
||||
{
|
||||
$chat_info = json_decode ($dt[1]);
|
||||
|
||||
$log_data[] = ['date_time' => $dt[0],
|
||||
'chat_icon' => $chat_info -> author -> imageUrl,
|
||||
'chat_name' => $escaped ? htmlspecialchars ($chat_info -> author -> name) : $chat_info -> author -> name,
|
||||
'chat_message' => $escaped ? htmlspecialchars ($chat_info -> message) : $chat_info -> message,
|
||||
'answer' => $escaped ? htmlspecialchars ($dt[2]) : $dt[2]];
|
||||
}
|
||||
}
|
||||
|
||||
fclose ($f);
|
||||
|
||||
unset ($f);
|
||||
|
||||
if ($keyword != '')
|
||||
{
|
||||
$log_data = array_filter ($log_data, fn ($row) => (
|
||||
strpos ($row['chat_name'] . "\n" . $row['chat_message'] . "\n" . $row['answer'],
|
||||
$keyword)
|
||||
!== false));
|
||||
}
|
||||
|
||||
if ($date_start)
|
||||
{
|
||||
$log_data = array_filter ($log_data, fn ($row) => (
|
||||
substr ($row['date_time'], 0, 10) >= $date_start));
|
||||
}
|
||||
|
||||
if ($date_end)
|
||||
{
|
||||
$log_data = array_filter ($log_data, fn ($row) => (
|
||||
substr ($row['date_time'], 0, 10) <= $date_end));
|
||||
}
|
||||
|
||||
$pages_max = (int) ((count ($log_data) - 1) / $length) + 1;
|
||||
|
||||
if (!($asc))
|
||||
$log_data = array_reverse ($log_data);
|
||||
|
||||
require_once './index.frm.php';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user