Скрываем логи
This commit is contained in:
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user