function dump_data_iteration($folder, $file) { $util = BopiProcessorFactory::getBopiProcessorTomo1($folder); $result = $util->process(substr($file, 0, 4), substr($file, 4, 2), substr($file, 6, 2)); $dumper = new CSVDumper(';'); $records = $dumper->dump_contents(substr($file, 0, 4), substr($file, 4, 2), substr($file, 6, 2), $GLOBALS['section'], $GLOBALS['subsection'], $result, $GLOBALS['dump_header']); if ($GLOBALS['dump_header'] && $records > 0) { $GLOBALS['dump_header'] = false; } }
function stats_process_iteration($folder, $file) { $tomo_1 = $folder . '/' . $file; $tomo_2 = str_replace('tomo1', 'tomo2', $tomo_1); $tomo_3 = str_replace('tomo1', 'tomo2', $tomo_1); $date = substr($file, 0, 8); $year = substr($file, 0, 4); $month = substr($file, 4, 2); $day = substr($file, 6, 2); $util = BopiProcessorFactory::getBopiProcessorTomo1($folder); if (file_exists($tomo_1)) { $result = $util->process($year, $month, $day); if ($result['status'] === 'ok') { foreach ($result as $namespace => $tables) { foreach ($tables as $tablename => $records) { print $year . ';' . $month . ';' . $day . ';TOMO1;' . $namespace . ';' . $tablename . ';' . count($records) . "\n"; } } } $util = BopiProcessorFactory::getBopiProcessorTomo2($folder); $result = $util->process($year, $month, $day); if ($result['status'] === 'ok') { foreach ($result as $namespace => $tables) { foreach ($tables as $tablename => $records) { print $year . ';' . $month . ';' . $day . ';TOMO2;' . $namespace . ';' . $tablename . ';' . count($records) . "\n"; } } } $util = BopiProcessorFactory::getBopiProcessorTomo3($folder); $result = $util->process($year, $month, $day); if ($result['status'] === 'ok') { foreach ($result as $namespace => $tables) { foreach ($tables as $tablename => $records) { print $year . ';' . $month . ';' . $day . ';TOMO3;' . $namespace . ';' . $tablename . ';' . count($records) . "\n"; } } } } }
require_once 'bopi/processors/processor.factory.inc'; require_once 'bopi/dumpers/CSVDumper.php'; //$working_folder = 'sandbox'; $working_folder = 'cache.bopi'; error_reporting(E_ERROR | E_PARSE); $year = $argv[1]; $month = $argv[2]; $day = $argv[3]; $tomo = $argc == 3 ? 1 : $argv[4]; // Get an instance switch ($tomo) { case 2: $util = BopiProcessorFactory::getBopiProcessorTomo2($working_folder); break; case 3: $util = BopiProcessorFactory::getBopiProcessorTomo3($working_folder); break; case 1: default: $util = BopiProcessorFactory::getBopiProcessorTomo1($working_folder); break; } $result = $util->process($year, $month, $day); print_r($result); //print('Solicitudes marcas:'.count($result['marcas']['solicitudes'])."\n"); //print('Solicitudes nombres:'.count($result['nombres_comerciales']['solicitudes'])."\n"); //$dumper = new CSVDumper(';'); //$dumper->dump_contents($year.$month.$day, 'marcas','solicitudes', $result); //print_r($result['marcas']['renovacion_denegada_marca']); //print('Result: '.$result."\n");