добавил несколько парсеров
This commit is contained in:
24
scripts/contingent_parser.php
Normal file
24
scripts/contingent_parser.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use SvedenParser\ContingentParser\ContingentManager;
|
||||
use Symfony\Component\Console\Helper\ProgressBar;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
define('SVEDEN_PARSER', '/home/developer/sveden_parser');
|
||||
define('TYPE_PARSER', explode('_', basename(__FILE__, '.php'))[0]);
|
||||
|
||||
require_once SVEDEN_PARSER . "/vendor/autoload.php";
|
||||
|
||||
|
||||
$manager = new ContingentManager();
|
||||
$sites = $manager->getSites();
|
||||
$progressBar = new ProgressBar(new ConsoleOutput(), count($sites));
|
||||
$progressBar->start();
|
||||
|
||||
$start = 0; $end = count($sites);
|
||||
for ($i = $start; $i < $end; $i++) {
|
||||
$manager->collectData($sites[$i]);
|
||||
$progressBar->advance();
|
||||
}
|
||||
$progressBar->finish();
|
||||
echo PHP_EOL;
|
19
scripts/convert_log_yaml.php
Normal file
19
scripts/convert_log_yaml.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
define('SVEDEN_PARSER', '/home/developer/sveden_parser');
|
||||
|
||||
require_once SVEDEN_PARSER . "/vendor/autoload.php";
|
||||
$filePath = SVEDEN_PARSER . "/data/doc.yaml";
|
||||
$file = file($filePath);
|
||||
|
||||
$sites = [];
|
||||
foreach ($file as $line) {
|
||||
$site = explode(' ', $line);
|
||||
$sites[] = [
|
||||
'org_id' => (int)$site[0],
|
||||
'site' => trim($site[1]),
|
||||
];
|
||||
}
|
||||
|
||||
$yaml = Yaml::dump($sites);
|
||||
file_put_contents($filePath, $yaml);
|
28
scripts/counter.php
Normal file
28
scripts/counter.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
use SvedenParser\Color;
|
||||
use SvedenParser\PriemParser\PriemManager;
|
||||
use SvedenParser\PriemParser\PriemRepository;
|
||||
use SvedenParser\Printer;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
define('SVEDEN_PARSER', '/home/developer/sveden_parser');
|
||||
|
||||
require_once SVEDEN_PARSER . "/vendor/autoload.php";
|
||||
|
||||
$manager = new PriemManager();
|
||||
$allOrg = $manager->getSites();
|
||||
Printer::println("All: " . count($allOrg), Color::GREEN);
|
||||
$inDB = (new PriemRepository())->universities();
|
||||
Printer::println("In DB: " . count($inDB), Color::GREEN);
|
||||
$docs = Yaml::parse(file_get_contents(SVEDEN_PARSER . "/data/doc.yaml"));
|
||||
Printer::println("Docs: " . count($docs), Color::GREEN);
|
||||
$remains = array_values(array_filter($allOrg, function($var) {
|
||||
global $inDB, $docs;
|
||||
return !in_array($var['org_id'], array_merge($inDB, array_column($docs, 'org_id')));
|
||||
}));
|
||||
Printer::println("Remains: " . count($remains), Color::RED);
|
||||
print_r($remains);
|
||||
|
||||
$yaml = Yaml::dump($remains);
|
||||
file_put_contents(SVEDEN_PARSER . "/data/remains.yaml", $yaml);
|
||||
|
24
scripts/employees_parser.php
Normal file
24
scripts/employees_parser.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use SvedenParser\EmployeesParser\EmployeesManager;
|
||||
use Symfony\Component\Console\Helper\ProgressBar;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
define('SVEDEN_PARSER', '/home/developer/sveden_parser');
|
||||
define('TYPE_PARSER', explode('_', basename(__FILE__, '.php'))[0]);
|
||||
|
||||
require_once SVEDEN_PARSER . "/vendor/autoload.php";
|
||||
|
||||
|
||||
$manager = new EmployeesManager();
|
||||
$sites = $manager->getSites();
|
||||
$progressBar = new ProgressBar(new ConsoleOutput(), count($sites));
|
||||
$progressBar->start();
|
||||
|
||||
$start = 0; $end = count($sites);
|
||||
for ($i = $start; $i < $end; $i++) {
|
||||
$manager->collectData($sites[$i]);
|
||||
$progressBar->advance();
|
||||
}
|
||||
$progressBar->finish();
|
||||
echo PHP_EOL;
|
24
scripts/priem_parser.php
Normal file
24
scripts/priem_parser.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use SvedenParser\PriemParser\PriemManager;
|
||||
use Symfony\Component\Console\Helper\ProgressBar;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
define('SVEDEN_PARSER', '/home/developer/sveden_parser');
|
||||
define('TYPE_PARSER', explode('_', basename(__FILE__, '.php'))[0]);
|
||||
|
||||
require_once SVEDEN_PARSER . "/vendor/autoload.php";
|
||||
|
||||
|
||||
$manager = new PriemManager();
|
||||
$sites = $manager->getSites();
|
||||
$progressBar = new ProgressBar(new ConsoleOutput(), count($sites));
|
||||
$progressBar->start();
|
||||
|
||||
$start = 0; $end = count($sites);
|
||||
for ($i = $start; $i < $end; $i++) {
|
||||
$manager->collectData($sites[$i]);
|
||||
$progressBar->advance();
|
||||
}
|
||||
$progressBar->finish();
|
||||
echo PHP_EOL;
|
36
scripts/set_hashes.php
Normal file
36
scripts/set_hashes.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use SvedenParser\ContingentParser\ContingentRepository;
|
||||
use SvedenParser\PriemParser\PriemRepository;
|
||||
define('SVEDEN_PARSER', '/home/developer/sveden_parser');
|
||||
|
||||
require_once SVEDEN_PARSER . "/vendor/autoload.php";
|
||||
|
||||
// $rep = new PriemRepository();
|
||||
// $ids = $rep->universities();
|
||||
// foreach ($ids as $id) {
|
||||
// echo $id . PHP_EOL;
|
||||
// $data = $rep->getData($id);
|
||||
// array_multisort($data);
|
||||
// $str = '';
|
||||
// foreach ($data as $dt) {
|
||||
// $str .= implode('', $dt);
|
||||
// }
|
||||
// $hashData = md5($str);
|
||||
// $rep->updateHash($id, $hashData);
|
||||
// }
|
||||
$rep = new ContingentRepository();
|
||||
$data = $rep->getData(64);
|
||||
array_multisort($data);
|
||||
$str = '';
|
||||
foreach ($data as $dt) {
|
||||
$str .= implode('', $dt);
|
||||
}
|
||||
$hashData = md5($str);
|
||||
$rep->updateHash(64, $hashData);
|
||||
|
||||
// file_put_contents('test1.txt', $str);
|
||||
// print_r($data);
|
||||
// echo md5($str) . PHP_EOL;
|
||||
|
||||
// echo file_get_contents('test.txt') === file_get_contents('test1.txt');
|
Reference in New Issue
Block a user