Joywork/cron/auto-search.php
2026-05-22 21:21:54 +03:00

36 lines
1.1 KiB
PHP

<?php
set_time_limit(0);
require_once($_SERVER['DOCUMENT_ROOT']."/config.php");
require_once($_SERVER['DOCUMENT_ROOT']."/engine/functions.php");
/*ini_set('display_errors', 1);
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);*/
$time = 0;
$count = 0;
$total = 0;
$error = [];
$autosearch = new AutoSearch();
$results = $autosearch->run(1000, 0, true, true);
foreach($results as $filter_id => $result) {
$time += $result['time'];
$count += $result['count'];
$total += $result['total'];
$error[] = $result['error'];
//echo "Processed filter (ID): $filter_id, average: $result[time] s., find count: $result[count] from total: $result[total]" . "<br/>";
}
//if (!empty($error)) {
// file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/telegramm_error_new.log',
// date('Y-m-d H:i:s') . " - errors: " . json_encode($error, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL,
// FILE_APPEND | LOCK_EX
// );
//}
//echo "Summary average: $time s., summary count: $count from total: $total" . "<br/>";
//if (!empty($error)) {
// echo "Errors: " . var_export($error, true);
//}