protected function stageProcessFiles() { if ($this->dbConnType == self::DB_TYPE_ORACLE) { $mtu = self::INSERTER_MTU_ORACLE; } else { $mtu = self::INSERTER_MTU; } $this->hitData['HANDLES']['LOCATION'] = new BlockInserter(array('entityName' => '\\Bitrix\\Sale\\Location\\LocationTable', 'exactFields' => array('CODE', 'TYPE_ID', 'PARENT_ID', 'LATITUDE', 'LONGITUDE'), 'parameters' => array('autoIncrementFld' => 'ID', 'mtu' => $mtu))); $this->hitData['HANDLES']['NAME'] = new BlockInserter(array('entityName' => '\\Bitrix\\Sale\\Location\\Name\\LocationTable', 'exactFields' => array('NAME', 'NAME_UPPER', 'LANGUAGE_ID', 'LOCATION_ID'), 'parameters' => array('mtu' => $mtu))); $this->hitData['HANDLES']['EXTERNAL'] = new BlockInserter(array('entityName' => '\\Bitrix\\Sale\\Location\\ExternalTable', 'exactFields' => array('SERVICE_ID', 'XML_ID', 'LOCATION_ID'), 'parameters' => array('mtu' => $mtu))); if ($this->getStep() == 0) { // set initial values $this->data['current'] = array('fIndex' => 0, 'bytesRead' => 0, 'linesRead' => 0); $this->hitData['HANDLES']['LOCATION']->resetAutoIncrementFromIndex(); // synchronize sequences, etc... // check if we are empty $this->data['TABLE_WERE_EMPTY'] = Location\LocationTable::getCountByFilter() == 0; $this->buildStaticLocationIndex(); } while ($this->checkQuota()) { $block = $this->readBlockFromCurrentFile2(); $this->importBlock($block); // clean memory $this->manageExistedLocationIndex(array($this->getCurrentGid())); // or the current file is completely exhausted if ($this->checkFileCompletelyRead()) { //$this->logMessage('Lines read: '.$this->data['current']['linesRead']); // charge next file unset($this->hitData['csv']); $this->data['current']['fIndex']++; // next file to go $this->data['current']['bytesRead'] = 0; // read counter from the beginning $this->data['current']['linesRead'] = 0; $this->data['current']['legacy'] = array(); // drop legacy data of the file, if were any. bye-bye // may be that is all? if ($this->checkAllFilesRead()) { unset($this->data['existedlocs']); // uff, remove that huge array at last $this->nextStage(); break; } } $this->nextStep(); } $this->hitData['HANDLES']['LOCATION']->flush(); $this->hitData['HANDLES']['NAME']->flush(); $this->hitData['HANDLES']['EXTERNAL']->flush(); $this->logMessage('Inserted, go next: ' . $this->getHitTimeString()); $this->logMemoryUsage(); }