本文整理汇总了PHP中Loader::Load方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::Load方法的具体用法?PHP Loader::Load怎么用?PHP Loader::Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::Load方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Load
public function Load()
{
parent::Load();
$altnames = $this->db->altnames;
$first = true;
while (($data = $this->ReadLine()) !== FALSE) {
if ($first) {
$first = false;
continue;
}
$item = array(Loader::OldIdField => $data[0], Loader::NewIdField => $data[1]);
$altnames->insert($item);
}
$altnames->ensureIndex(array(Loader::OldIdField => 1), array('background' => true, 'unique' => true, 'dropDups' => true));
$this->Close();
return true;
}
示例2: Load
public function Load()
{
parent::Load();
$socrbase = $this->db->socrbase;
$socrbase->ensureIndex(array(Loader::TypeShortField => 1), array('background' => true));
$first = true;
while (($data = $this->ReadLine()) !== FALSE) {
if ($first) {
$first = false;
continue;
}
$item = array(Loader::TypeShortField => $data[1], Loader::TypeField => $data[2]);
$socrbase->insert($item);
}
$this->Close();
return true;
}
示例3: Load
public function Load()
{
parent::Load();
$altnames = $this->db->altnames;
$socrbase = $this->db->socrbase;
$regions = $this->db->regions;
$district = $this->db->district;
$cities = $this->db->cities;
$first = true;
$i = 0;
while (($data = $this->ReadLine()) !== FALSE) {
if ($first) {
$first = false;
continue;
}
$arData = array();
if ($i++ % 10000 == 0) {
echo $i . '; ';
}
$id_key = $this->arFieldConformity[Loader::IdField];
$cursor = $altnames->find(array(Loader::OldIdField => $data[$id_key]));
foreach ($cursor as $el) {
$data[$id_key] = $el[Loader::NewIdField];
break;
}
foreach ($this->arFieldConformity as $key => $conform) {
$arData[$key] = $data[$conform] ? $data[$conform] : null;
if ($key == Loader::NameField) {
$arData[Loader::NormalizedNameField] = __normalize($arData[$key]);
}
}
$typeShortField = Loader::TypeShortField;
$typeField = Loader::TypeField;
$cursor = $socrbase->find(array($typeShortField => $arData[$typeShortField]));
foreach ($cursor as $type) {
$arData[$typeField] = $type[$typeField];
break;
}
$code = $arData[Loader::IdField];
$arCode = $this->ReadCode($code);
$arCodeField = $this->GetCodeField($arCode);
foreach ($arCodeField as $field => $value) {
$arData[$field] = $value;
}
$sort = 100000;
$typeCode = 0;
switch ($arData[Loader::TypeShortField]) {
case 'г':
$sort = 1000;
$typeCode = 1;
break;
case 'городок':
$sort = 2000;
$typeCode = 1;
break;
case 'пгт':
$sort = 3000;
$typeCode = 2;
break;
case 'п':
$sort = 4000;
$typeCode = 2;
break;
case 'дп':
$sort = 5000;
$typeCode = 2;
break;
case 'кп':
$sort = 6000;
$typeCode = 2;
break;
case 'рп':
$sort = 7000;
$typeCode = 2;
break;
case 'с':
$sort = 8000;
$typeCode = 4;
break;
case 'д':
$sort = 9000;
$typeCode = 4;
break;
case 'ст':
$sort = 10000;
$typeCode = 4;
break;
default:
$sort = 100000;
$typeCode = 4;
break;
}
$arData[Loader::SortField] = $sort;
$arData[Loader::TypeCode] = $typeCode;
$type = $this->GetType($arCode);
// поднимаем выше те города, у которых есть ссылка на район
if ($arData[Loader::CodeDistrictField]) {
$arData[Loader::SortField] = $arData[Loader::SortField] - 10;
}
$arData[Loader::Bad] = substr($arData[Loader::IdField], -2) != '00';
//.........这里部分代码省略.........
示例4: Load
public function Load()
{
parent::Load();
$altnames = $this->db->altnames;
$socrbase = $this->db->socrbase;
$streets = $this->db->streets;
/*
*/
$first = true;
$i = 0;
while (($data = $this->ReadLine()) !== FALSE) {
if ($first) {
$first = false;
continue;
}
$arData = array();
if ($i++ % 10000 == 0) {
echo $i . '; ';
}
$id_key = $this->arFieldConformity[Loader::IdField];
$cursor = $altnames->find(array(Loader::OldIdField => $data[$id_key]));
foreach ($cursor as $el) {
$data[$id_key] = $el[Loader::NewIdField];
break;
}
foreach ($this->arFieldConformity as $key => $conform) {
$arData[$key] = $data[$conform] ? $data[$conform] : null;
if ($key == Loader::NameField) {
$arData[Loader::NormalizedNameField] = __normalize($arData[$key]);
}
}
$typeShortField = Loader::TypeShortField;
$typeField = Loader::TypeField;
$cursor = $socrbase->find(array($typeShortField => $arData[$typeShortField]));
foreach ($cursor as $type) {
$arData[$typeField] = $type[$typeField];
break;
}
$code = $arData[Loader::IdField];
$arCode = $this->ReadCode($code);
$arCodeField = $this->GetCodeField($arCode);
$arData[Loader::Bad] = substr($arData[Loader::IdField], -2) != '00';
foreach ($arCodeField as $field => $value) {
$arData[$field] = $value;
}
//$arData = array_slice($arData, 0, 11);
$streets->insert($arData);
}
echo " creating indecies ";
$streets->ensureIndex(array(Loader::IdField => 1, "unique" => true, "dropDups" => true), array('background' => true));
$streets->ensureIndex(array(Loader::NormalizedNameField => 1), array('background' => true));
$streets->ensureIndex(array(Loader::CodeRegionField => 1), array('background' => true));
$streets->ensureIndex(array(Loader::CodeDistrictField => 1), array('background' => true));
$streets->ensureIndex(array(Loader::CodeLocalityField => 1), array('background' => true));
$streets->ensureIndex(array(Loader::SortField => 1), array('background' => true));
$streets->ensureIndex(array(Loader::Bad => 1), array('background' => true));
$streets->ensureIndex(array(Loader::NameField => 1), array('background' => true));
$streets->ensureIndex(array(Loader::CodeLocalityField => 1, Loader::CodeRegionField => 1, Loader::CodeDistrictField => 1, Loader::CodeStreetField => 1), array('background' => true));
$streets->ensureIndex(array(Loader::CodeLocalityField => 1, Loader::CodeRegionField => 1, Loader::CodeDistrictField => 1, Loader::Bad => 1, Loader::NormalizedNameField => 1), array('background' => true));
$this->Close();
return true;
}
示例5: Load
public function Load()
{
parent::Load();
$altnames = $this->db->altnames;
$buildings = $this->db->buildings;
$first = true;
$i = 0;
while (($data = $this->ReadLine()) !== FALSE) {
if ($first) {
$first = false;
continue;
}
$arData = array();
if ($i++ % 10000 == 0) {
echo $i . '; ';
}
$id_key = $this->arFieldConformity[Loader::IdField];
$cursor = $altnames->find(array(Loader::OldIdField => $data[$id_key]));
foreach ($cursor as $el) {
$data[$id_key] = $el[Loader::NewIdField];
break;
}
foreach ($this->arFieldConformity as $key => $conform) {
$arData[$key] = $data[$conform] ? $data[$conform] : null;
if ($key == Loader::NameField) {
$arData[Loader::NormalizedNameField] = __normalize($arData[$key]);
}
if ($key == Loader::TypeField) {
if ($arData[$key] == 'ДОМ') {
$arData[$key] = 'дом';
}
}
if ($key == Loader::TypeShortField) {
if ($arData[$key] == 'ДОМ') {
$arData[$key] = 'д';
}
}
}
$code = $arData[Loader::IdField];
$arCode = $this->ReadCode($code);
$arCodeField = $this->GetCodeField($arCode);
foreach ($arCodeField as $field => $value) {
$arData[$field] = $value;
}
$arData[Loader::ZipCodeField] = intval($arData[Loader::ZipCodeField]);
$arData = $this->fixData($arData);
$buildings->insert($arData);
}
echo " Creating indecies ";
$buildings->ensureIndex(array(Loader::NormalizedNameField => 1), array('background' => true));
$buildings->ensureIndex(array(Loader::CodeRegionField => 1), array('background' => true));
$buildings->ensureIndex(array(Loader::CodeDistrictField => 1), array('background' => true));
$buildings->ensureIndex(array(Loader::CodeLocalityField => 1), array('background' => true));
$buildings->ensureIndex(array(Loader::CodeStreetField => 1), array('background' => true));
$buildings->ensureIndex(array(Loader::SortField => 1), array('background' => true));
$buildings->ensureIndex(array(Loader::ZipCodeField => 1), array('background' => true));
$buildings->ensureIndex(array(Loader::IdField => 1), array('background' => true, "unique" => true, "dropDups" => true));
$buildings->ensureIndex(array(Loader::NormalizedNameField => 1, Loader::CodeRegionField => 1, Loader::CodeStreetField => 1, Loader::CodeDistrictField => 1, Loader::CodeLocalityField => 1), array('background' => true));
$buildings->ensureIndex(array(Loader::CodeRegionField => 1, Loader::CodeStreetField => 1, Loader::CodeDistrictField => 1, Loader::CodeLocalityField => 1), array('background' => true));
$this->Close();
return true;
}
示例6: Loader
<?php
//Reporte de errores habilitado
error_reporting(E_ALL ^ E_DEPRECATED);
//Inicio de sesiones
session_start();
//Inclusión del archivo de configuración
require 'config/config.inc.php';
//Inclusión de módulo de carga
require 'modules/load/load.class.php';
//Iniciación de la carga del sistema
$Loader = new Loader();
$Loader->Load();
//test