Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Necessary to combine intervals with the same data #6

Closed
@ddrv

Description

@ddrv

What steps will reproduce the problem?

file networks.csv

first_ip,last_ip,register_id
"0.0.0.0","63.255.255.255",1
"64.0.0.0","127.255.255.255",2
"128.0.0.0","191.255.255.255",2
"192.0.0.0","255.255.255.255",2

file info.csv

id,name
1,"small interval"
2,"big interval"

script of converting

$tmpDir = __DIR__.DIRECTORY_SEPARATOR.'tmp';
$csvDir = __DIR__.DIRECTORY_SEPARATOR.'csv';
$dbFile = __DIR__.DIRECTORY_SEPARATOR.'dat'.DIRECTORY_SEPARATOR.'iptool.dat';
$converter = new Converter($tmpDir);

$converter->setAuthor('Ivan Dudarev');
$converter->setTime(time());
$converter->setLicense('MIT');

$converter->addCSV('infoCSV',$csvDir.DIRECTORY_SEPARATOR.'info.csv',1);
$converter->addCSV('networksCSV',$csvDir.DIRECTORY_SEPARATOR.'networks.csv',1);

$info = array(
    'name' => array(
        'type' => 'string',
        'column' => 1,
    ),
);
$converter->addRegister('info','infoCSV',0, $info);

$networks = array(
    'info' => 2,
);
$converter->addNetworks('networksCSV', 'ip', 0, 1, $networks);
$converter->create($dbFile);

$iptool = new Iptool($dbFile);
$meta = $iptool->about();
print_r($meta)    

What is the expected result?

Array
(
    ...
    [networks] => Array
        (
            [count] => 2
            ...
        )
)

What do you get instead?

Array
(
    ...
    [networks] => Array
        (
            [count] => 4
            ...
        )
)

Additional info

Q A
IP Tool version 1.0.8
PHP version 7.0
Operating system Linux Mint

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions