Обновлены настройки Client, дозапись в базу
This commit is contained in:
@ -81,21 +81,12 @@ final class ContingentManager
|
||||
return $orgs;
|
||||
}
|
||||
|
||||
public function buildURL(string $url): string
|
||||
public function buildBaseUri(string $url): string
|
||||
{
|
||||
// Строит -> https://<base_uri>/sveden/education/
|
||||
$offset = strpos($url, '/', strlen('http://'));
|
||||
if ($offset) {
|
||||
$url = substr_replace($url, '', $offset);
|
||||
// Строит -> https://<base_uri>
|
||||
if (strpos($url,'https://') === false && strpos($url,'http://') === false) {
|
||||
$url = "http://$url";
|
||||
}
|
||||
|
||||
$url = "$url/sveden/education/";
|
||||
if (str_contains($url, "http://")) {
|
||||
$url = str_replace("http://","https://", $url);
|
||||
} else {
|
||||
$url = "https://$url";
|
||||
}
|
||||
$url = str_replace("www.","", $url);
|
||||
|
||||
return $url;
|
||||
}
|
||||
@ -130,4 +121,32 @@ final class ContingentManager
|
||||
}
|
||||
return $count ? true : false;
|
||||
}
|
||||
|
||||
public function getExceptionsHtml(string $filename) : array
|
||||
{
|
||||
$errorSites = [];
|
||||
$array = file($filename);
|
||||
for ($i = 0; $i < count($array); $i++) {
|
||||
$arr = explode(' ', $array[$i]);
|
||||
$errorSites[] = $arr[2];
|
||||
}
|
||||
return $errorSites;
|
||||
}
|
||||
|
||||
public function getExceptionsHttpCurl(string $filename) : array
|
||||
{
|
||||
$array = file($filename);
|
||||
$orgHttpError = [];
|
||||
foreach ($array as $str) {
|
||||
$data = explode (' ', $str);
|
||||
if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $data[0])
|
||||
&& $data[3] != PHP_EOL) {
|
||||
$orgHttpError[] = $data[2];
|
||||
// $orgHttpError[] = ['org_id' => $data[2], 'site' => $data[3]];
|
||||
}
|
||||
}
|
||||
$orgHttpError = array_unique($orgHttpError);
|
||||
sort($orgHttpError);
|
||||
return $orgHttpError;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user