Working in the migration.

This commit is contained in:
mdtrooper 2016-02-01 15:12:21 +01:00
parent d74a22aecf
commit 71f38f7e02
3 changed files with 80 additions and 0 deletions

View File

@ -460,4 +460,19 @@ define("OPTION_TREE_GROUP_SELECT", 6);
define("OPTION_SINGLE_SELECT_TIME", 7);
define("OPTION_CUSTOM_INPUT", 8);
define("OPTION_AGENT_AUTOCOMPLETE", 9);
/* Maps (new networkmaps and new visualmaps) */
define("MAP_TYPE_NETWORKMAP", 0);
define("MAP_TYPE_VISUALMAP", 1);
define("MAP_SUBTYPE_TOPOLOGY", 0);
define("MAP_SUBTYPE_POLICIES", 1);
define("MAP_SUBTYPE_GROUPS", 2);
define("MAP_SUBTYPE_RADIAL_DYNAMIC", 3);
define("MAP_GENERATION_CIRCULAR", 0);
define("MAP_GENERATION_PLANO", 1);
define("MAP_GENERATION_RADIAL", 2);
define("MAP_GENERATION_SPRING1", 3);
define("MAP_GENERATION_SPRING2", 4);
?>

View File

@ -21,7 +21,70 @@
* @subpackage Migration
*/
require_once("include/functions_maps.php");
function migration_open_networkmaps() {
$old_networkmaps_open = db_get_all_rows_in_table("tnetwork_map");
//~ html_debug($old_networkmaps_open);
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());
}
}
?>

View File

@ -36,6 +36,8 @@ if (!$networkmaps_read && !$networkmaps_write && !$networkmaps_manage) {
}
}
require_once('include/functions_migration.php');
$migrate_open_networkmaps = (int)get_parameter('migrate_open_networkmaps');
if ($migrate_open_networkmaps)