2016-02-01 12:55:35 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation; version 2
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @package Include
|
|
|
|
* @subpackage Migration
|
|
|
|
*/
|
|
|
|
|
2016-02-01 15:12:21 +01:00
|
|
|
require_once("include/functions_maps.php");
|
|
|
|
|
2016-02-01 12:55:35 +01:00
|
|
|
function migration_open_networkmaps() {
|
2016-02-01 15:12:21 +01:00
|
|
|
$old_networkmaps_open = db_get_all_rows_in_table("tnetwork_map");
|
|
|
|
|
|
|
|
//~ html_debug($old_networkmaps_open);
|
2016-02-01 12:55:35 +01:00
|
|
|
|
2016-02-01 15:12:21 +01:00
|
|
|
foreach ($old_networkmaps_open as $old_netw_open) {
|
|
|
|
$new_networkmap = array();
|
|
|
|
|
|
|
|
$new_networkmap['name'] = $old_netw_open['name'];
|
|
|
|
$new_networkmap['id_user'] = $old_netw_open['id_user'];
|
|
|
|
|
|
|
|
switch ($old_netw_open['id_user']) {
|
|
|
|
case 'topology':
|
|
|
|
$new_networkmap['type'] = MAP_TYPE_NETWORKMAP;
|
|
|
|
$new_networkmap['subtype'] = MAP_SUBTYPE_TOPOLOGY;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($old_netw_open['layout']) {
|
|
|
|
case 'radial':
|
|
|
|
$new_networkmap['generation_method'] = MAP_GENERATION_RADIAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$filter = array();
|
|
|
|
|
|
|
|
$filter['show_groups'] = 0;
|
|
|
|
if ($old_netw_open['show_groups']) {
|
|
|
|
$filter['show_groups'] = 1;
|
|
|
|
}
|
|
|
|
$filter['show_module_plugins'] = 0;
|
|
|
|
$filter['show_snmp_modules'] = 0;
|
|
|
|
if ($old_netw_open['show_snmp_modules']) {
|
|
|
|
$filter['show_snmp_modules'] = 1;
|
|
|
|
}
|
|
|
|
$filter['show_modules'] = 0;
|
|
|
|
if ($old_netw_open['show_modules']) {
|
|
|
|
$filter['show_modules'] = 1;
|
|
|
|
}
|
|
|
|
$filter['show_policy_modules'] = 0;
|
|
|
|
$filter['show_pandora_nodes'] = 0;
|
|
|
|
$filter['show_only_modules_with_alerts'] = 0;
|
|
|
|
if ($old_netw_open['only_modules_with_alerts']) {
|
|
|
|
$filter['show_only_modules_with_alerts'] = 1;
|
|
|
|
}
|
|
|
|
$filter['show_module_group'] = 0;
|
|
|
|
if ($old_netw_open['show_modulegroup']) {
|
|
|
|
$filter['show_module_group'] = 1;
|
|
|
|
}
|
|
|
|
$filter['id_tag'] = 0;
|
|
|
|
if ($old_netw_open['id_tag']) {
|
|
|
|
$filter['id_tag'] = 1;
|
|
|
|
}
|
|
|
|
$filter['text'] = '';
|
|
|
|
|
|
|
|
$new_networkmap['filter'] = json_encode($filter);
|
|
|
|
|
|
|
|
html_debug($new_networkmap);
|
|
|
|
|
|
|
|
html_debug(maps_save_map($new_networkmap));
|
|
|
|
html_debug(mysql_error());
|
|
|
|
}
|
2016-02-01 12:55:35 +01:00
|
|
|
}
|
|
|
|
?>
|