diff --git a/app/bot.php b/app/bot.php index b5f0b79..309d98c 100644 --- a/app/bot.php +++ b/app/bot.php @@ -1076,23 +1076,27 @@ class Bot public function checkBackup() { $c = $this->getPacConf(); - $now = strtotime(date('Y-m-d H:i')); if (!empty($c['backup'])) { + $now = strtotime(date('Y-m-d H:i:s')); [$start, $period] = explode('/', $c['backup']); - $start = strtotime($start); - $period = strtotime($period, 0); - if (!empty($start) && !empty($period)) { - if ($now - $start >= $period && ($now - $start) % $period == 0) { - if (!empty($c['pinbackup'])) { - $this->pinAdmin($c['pinbackup'], 1); - } - $this->pinBackup(); + $start = strtotime(trim($start)); + $period = strtotime(trim($period), 0); + if ( + !empty($start) + && !empty($period) + && empty($this->backup) + && $now - $start >= $period + && ($now - $start) % $period < 10 + ) { + if (!empty($c['pinbackup'])) { + $this->pinAdmin($c['pinbackup'], 1); } + $this->pinBackup(); } } } - public function cleanQueue() + public function cleanQueue(): void { $r = $this->request('deleteWebhook', []); $r = $this->request('getUpdates', ['offset' => -1]); @@ -1112,9 +1116,8 @@ class Bot { require __DIR__ . '/config.php'; $conf = $this->getPacConf(); - $bot = $this->request('getMyName', [])['result']['name']; + $bot = preg_replace('~[\W]~iu', '_', $this->request('getMyName', [])['result']['name']); $conf['pinbackup'] = $this->upload("{$bot}_export_" . date('d_m_Y_H_i') . '.json', $this->export(), $c['admin'][0])['result']['message_id']; - $conf['backup'] = implode(' / ', [date('Y-m-d H:i'), trim(explode('/', $conf['backup'])[1])]); $this->setPacConf($conf); $this->pinAdmin($conf['pinbackup']); } diff --git a/version b/version index 9a8bee4..a80d43f 100644 --- a/version +++ b/version @@ -1,3 +1,5 @@ +23.10.2024 v1.82 +- фикс автобэкапа 23.10.2024 v1.81 - фикс краша wireguard после апдейта 23.10.2024 v1.80