Added basic Citycom ADB Import
This commit is contained in:
@@ -113,7 +113,7 @@ foreach ($netowners as $apiOwner) {
|
||||
}
|
||||
|
||||
foreach ($clustersResponse->item as $cluster) {
|
||||
$cluster_data = ["apiOwner" => $apiOwner, "apiKey" => $apiToken, "apiUrl" => $apiUrl, "cluster" => $cluster];
|
||||
$cluster_data = ["apiOwner" => $apiOwner, "apiKey" => $apiToken, "apiUrl" => $apiUrl, "source_id" => $cluster->id, "cluster" => $cluster];
|
||||
$clusters[$cluster->id] = $cluster_data;
|
||||
}
|
||||
}
|
||||
@@ -126,12 +126,13 @@ foreach(\ADBNetzgebietModel::getAll() as $adb_cluster) {
|
||||
}
|
||||
|
||||
if(!array_key_exists($adb_cluster->source_id, $clusters)) {
|
||||
//$clusters[$adb_cluster->source_id] = ["apiOwner" => "", "apiKey" => "", "apiUrl" => "", "cluster" => $adb_cluster];
|
||||
$clusters[$adb_cluster->source_id] = ["apiOwner" => "", "apiKey" => "", "apiUrl" => "", "source_id" => $adb_cluster->source_id, "cluster" => $adb_cluster];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($clusters as $cluster_data) {
|
||||
$cluster = $cluster_data["cluster"];
|
||||
$cluster_source_id = $cluster_data["source_id"];
|
||||
$apiOwner = $cluster_data["apiOwner"];
|
||||
$apiUrl = $cluster_data["apiUrl"];
|
||||
$apiToken = $cluster_data["apiKey"];
|
||||
@@ -142,34 +143,52 @@ foreach ($clusters as $cluster_data) {
|
||||
$cluster_name = $cluster->name;
|
||||
|
||||
if ($command == "list-rimo-clusters") {
|
||||
echo "($apiOwner) $cluster_rimo_id | name: " . $cluster->name . "; label: " . $cluster->userLabel . "\n";
|
||||
echo "($apiOwner) $cluster_source_id | name: " . $cluster->name . "; label: " . $cluster->userLabel . "\n";
|
||||
continue;
|
||||
}
|
||||
$adb_netzgebiet = \ADBNetzgebietModel::getFirst(['rimo_id' => $cluster_rimo_id]);
|
||||
$adb_netzgebiet = \ADBNetzgebietModel::getFirst(['source_id' => $cluster_source_id]);
|
||||
if (!$adb_netzgebiet) {
|
||||
//echo "Kein Netzgebiet für Salescluster $cluster_rimo_id (".$cluster->name.")\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
//echo "command: $command request_cluster: $request_cluster - cluster_source_id $cluster_source_id\n";
|
||||
if ($command == "cluster_only" && $request_cluster) {
|
||||
if ($cluster_source_id != $request_cluster) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* import non-rimo clusters
|
||||
*/
|
||||
//echo $adb_netzgebiet->source." ".$adb_netzgebiet->source_id."\n";continue;
|
||||
if($adb_netzgebiet->source == "citycom-oan-api" ) {
|
||||
// load and run citycom importer
|
||||
/*
|
||||
$citycom_importer = new CitycomImporter(["db" => $adb, "log" => $log, "netzgebiet" => $adb_netzgebiet]);
|
||||
echo "Netzgebiet ".$adb_netzgebiet->name." is Citycom OAN\n";
|
||||
|
||||
require_once __DIR__."/importer/citycom.php";
|
||||
$citycom_importer = new importer\CitycomImporter(["db" => $adb, "log" => $log, "netzgebiet" => $adb_netzgebiet]);
|
||||
$citycom_importer->runImport();
|
||||
*/
|
||||
|
||||
// log errors
|
||||
if ($citycom_importer->addressErrors) {
|
||||
$netzname = preg_replace('/[^a-z0-9.-]/i', "_", $adb_netzgebiet->name);
|
||||
|
||||
$out_folder = dirname(__FILE__) . "/output/$startdate";
|
||||
if (!file_exists($out_folder)) {
|
||||
mkdir($out_folder);
|
||||
}
|
||||
$out_filename = $out_folder . "/output-$netzname-$starttime.log";
|
||||
file_put_contents($out_filename, join("\n", $citycom_importer->addressErrors));
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$addressErrors = [];
|
||||
|
||||
if ($command == "cluster_only" && $request_cluster) {
|
||||
if ($cluster_rimo_id != $request_cluster) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$baseParams = ['apiKey' => $apiToken];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user