game/cron/battle_optimize.php

22 lines
733 B
PHP
Raw Normal View History

2022-06-06 21:30:34 +00:00
<?php
/** <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>.
* @var PDO $pdo
* @author Insallah
*/
const GAME = true;
define('DAY', 24 * 60 * 60);
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
2022-06-06 21:30:34 +00:00
$tables = ['battle_end', 'battle_last', 'battle_out', 'battle_stat', 'battle_logs', 'battle_logs_save'];
$q = [
'delete from battle_users where time_enter < unix_timestamp() - ? and time_enter != 0',
'delete from battle where time_over < unix_timestamp() - ? and time_over != 0',
];
foreach ($tables as $table) {
$pdo->prepare("delete from $table where time < unix_timestamp() - ?")->execute(DAY);
}
$pdo->prepare($q[0])->execute(DAY);
$pdo->prepare($q[1])->execute(DAY);