- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/location/import/compiler/compiler.php
- Класс: BitrixSaleLocationImportCompilerCompiler
- Вызов: Compiler::compile
public function compile()
{
// step 1: build main tree from yandex market data
//$this->buildMainTree();
##########################################################
#### MAP FIAS TO YANDEX
##########################################################
// step 2: processing huge fias file
//$this->splitFiasOnRegions(); // split huge fias file onto small pieces of bundles
/*
Handwriting:
move 0c5b2444-70a0-4932-980c-b4dc0d3f02b5;1;1;Москва;г; TO 29251dcf-00a1-4e34-98d4-5c47484a36d4.csv
move c2deb16a-0330-4f05-821f-1d09c93331e6;1;1;Санкт-Петербург;г;190000 TO 6d1ebb35-70c6-4129-bd55-da3969658f5d.csv
move 6fdecb78-893a-4e3f-a5ba-aa062459463b;1;1;Севастополь;г; TO bd8e6511-e4b9-4841-90de-6bbc231a789e.csv
*/
//$this->copyFias2DB(); // place fias to db
// step 3: map fias to yandex id. There were some handwriting to map files, so do not uncomment unless you want files to be overwritten
//$this->mapFiasRootV2(); // process fias root and find matches by regions
// then we have a little handwriting on rootv2.csv
//$this->mapFiasCities(); // find cities and villages matches
// again, handwriting here
##########################################################
#### FIAS 2 DB
##########################################################
/*
$this->copyFias2DB();
update b_tmp_fias set PARENTGUID = '29251dcf-00a1-4e34-98d4-5c47484a36d4' where AOGUID = '0c5b2444-70a0-4932-980c-b4dc0d3f02b5' and AOID = '5c8b06f1-518e-496e-b683-7bf917e0d70b';
update b_tmp_fias set PARENTGUID = '6d1ebb35-70c6-4129-bd55-da3969658f5d' where AOGUID = 'c2deb16a-0330-4f05-821f-1d09c93331e6' and AOID = 'aad1469e-54ff-4605-af4f-f016c75b84d2';
update b_tmp_fias set PARENTGUID = 'bd8e6511-e4b9-4841-90de-6bbc231a789e' where AOGUID = '6fdecb78-893a-4e3f-a5ba-aa062459463b' and AOID = '6fdecb78-893a-4e3f-a5ba-aa062459463b';
*/
##########################################################
#### MAKE EXPORT TABLE
##########################################################
/*
$res = YandexGeoCoder::query(array(
'query' => 'Ненецкий автономный округ Шойна село Школьная улица',
'kind' => YandexGeoCoder::KIND_STREET
));
*/
$this->output('Build main tree');
$this->buildMainTree();
$this->createExportTables();
/*
###################################################################
###################################################################
###################################################################
// making world
$this->eTreeDB->cleanup();
$this->eTreeDB->dropIndexes();
$this->output('Generate export tree: Belarus');
$this->generateExportTreeBelorussia();
$this->output('Generate export tree: Kazakhstan');
$this->generateExportTreeLegacy(self::KAZAKHSTAN_SOURCE);
$this->output('Generate export tree: Ukrain');
$this->generateExportTreeUkrain();
$this->output('Generate export tree: USA');
$this->generateExportTreeUSA();
$this->output('Generate export tree: World Countries');
$this->generateExportTreeWorld();
$this->output('Generate export tree: EX-CIS');
$this->generateExportTreeLegacy(self::CIS_SOURCE);
###################################################################
###################################################################
###################################################################
$this->output('Last occupied: '.$this->eTreeDB->getLastOccupiedCode());
$this->output('Next free: '.$this->eTreeDB->getNextFreeCode());
// making russia
$this->eTreeDBRussia->cleanup();
$this->eTreeDBRussia->dropIndexes();
$this->output('Generate export tree: Russia');
$this->generateExportTreeRussia();
$this->output('Last occupied: '.$this->eTreeDBRussia->getLastOccupiedCode());
$this->output('Next free: '.$this->eTreeDBRussia->getNextFreeCode());
###################################################################
###################################################################
###################################################################
*/
$this->restoreExportTablesIndexes();
$this->output('Build export files');
/*
$this->cleanPoolDir('assets');
$this->eTreeDB->walkInDeep(array($this, 'generateExportFilesFromTableBundle')); // world
$this->eTreeDBRussia->walkInDeep(array($this, 'generateExportFilesFromTableBundle')); // russia
*/
$this->cleanPoolDir('assets_standard');
$this->eTreeDB->walkInDeep(array(
'ITEM' => array($this, 'generateExportFilesFromTableBundle_Standard')
)); // world
$this->eTreeDBRussia->walkInDeep(array(
'ITEM' => array($this, 'generateExportFilesFromTableBundle_Standard_YandexOnly')
)); // russia
/*
// types by groups
$this->makeTypeGroupFile(self::GROUP_FILE);
$this->copyStaticCSV();
*/
###################################################################
###################################################################
###################################################################
/*
$this->output('Build demo files');
$this->cleanPoolDir('demo');
$this->eTreeDB->walkInDeep(array($this, 'generateDemoFilesWorld'), array('VILLAGE' => 1)); // world
$this->eTreeDBRussia->walkInDeep(array($this, 'generateDemoFilesRussia'), array('VILLAGE' => 1)); // world
*/
/*
добавить сюда генерацию файла country_codes.php с содержимым:
$LOCALIZATION_COUNTRY_CODE_MAP = array(
'ru' => '0000028023',
'ua' => '0000000364',
'kz' => '0000000276',
'bl' => '0000000001'
);
этот файл потом идёт в мастер установки интернет-магазина, вместе с демо-данными, types.csv и externalservice.csv
*/
$this->output('DONE');
}