Скрываем логи

This commit is contained in:
2024-08-20 11:47:27 +03:00
parent 826ae10f10
commit 29eeb5bf77
8 changed files with 16 additions and 4112 deletions

View File

@ -43,7 +43,7 @@ $orgs = ContingentManager::getInstance()->getOrgs($dbOpendata);
// }
// }
$start = 91;
$start = 999;
for ($i = $start; $i < count($sites); $i++) {
// Нет URL сайта вуза
@ -81,6 +81,11 @@ for ($i = $start; $i < count($sites); $i++) {
echo $response->getStatusCode() .PHP_EOL;
$html = $response->getBody()->getContents();
if (empty($html)) {
$message = $sites[$i]['org_id'] . ' ' . $sites[$i]['site'];
Logger::log($pathLogErrorHtml, $message);
continue;
}
$parser = new ContingentParser($html, '//tr[@itemprop="eduChislen"]//');
$contingent = $parser->getDataTable();

View File

@ -70,9 +70,16 @@ class Database
} catch (PDOException $e) {
// При ошибке запроса сохраняем валидные данные в yaml-файл
$yaml = Yaml::dump($params);
file_put_contents(__DIR__ . '/not-recorded-in-db.yaml', $yaml);
file_put_contents(__DIR__ . '/not-recorded-in-db.yaml', $yaml, FILE_APPEND);
$message = "Ошибка запроса:" . $e->getMessage();
Logger::log(self::$logFile, $message);
// TODO узнать код ошибки
// SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
// if ($e->getCode() == 0) {
// $yaml = Yaml::dump($params);
// file_put_contents(__DIR__ . '/not-recorded-in-db.yaml', $yaml);
// exit(1);
// }
}
}
}