当前位置: 首页>>代码示例>>PHP>>正文


PHP db_install_execute函数代码示例

本文整理汇总了PHP中db_install_execute函数的典型用法代码示例。如果您正苦于以下问题:PHP db_install_execute函数的具体用法?PHP db_install_execute怎么用?PHP db_install_execute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了db_install_execute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upgrade_to_0_8_7a

function upgrade_to_0_8_7a()
{
    /* add alpha channel to graph items */
    db_install_execute("0.8.7a", "ALTER TABLE `graph_templates_item` ADD COLUMN `alpha` CHAR(2) DEFAULT 'FF' AFTER `color_id`;");
    /* add units=si as an option */
    db_install_execute("0.8.7a", "ALTER TABLE `graph_templates_graph` ADD COLUMN `t_scale_log_units` CHAR(2) DEFAULT 0 AFTER `auto_scale_log`, ADD COLUMN `scale_log_units` CHAR(2) DEFAULT '' AFTER `t_scale_log_units`;");
}
开发者ID:songchin,项目名称:Cacti,代码行数:7,代码来源:0_8_7_to_0_8_7a.php

示例2: upgrade_to_0_8_7b

function upgrade_to_0_8_7b()
{
    /* add Task Item Id Index */
    db_install_execute("0.8.7b", "ALTER TABLE `graph_templates_item` ADD INDEX `task_item_id` ( `task_item_id` )");
    /* make CLI more responsive */
    db_install_execute("0.8.7b", "ALTER TABLE `data_input_data` ADD INDEX `t_value`(`t_value`)");
}
开发者ID:resmon,项目名称:resmon-cacti,代码行数:7,代码来源:0_8_7a_to_0_8_7b.php

示例3: upgrade_to_0_8_6d

function upgrade_to_0_8_6d()
{
    /* changes for long OID's */
    db_install_execute("0.8.6d", "ALTER TABLE `host_snmp_cache` CHANGE `snmp_index` `snmp_index` VARCHAR( 100 ) NOT NULL;");
    db_install_execute("0.8.6d", "ALTER TABLE `data_local` CHANGE `snmp_index` `snmp_index` VARCHAR( 100 ) NOT NULL;");
    db_install_execute("0.8.6d", "ALTER TABLE `graph_local` CHANGE `snmp_index` `snmp_index` VARCHAR( 100 ) NOT NULL;");
}
开发者ID:BackupTheBerlios,项目名称:odp-svn,代码行数:7,代码来源:0_8_6c_to_0_8_6d.php

示例4: upgrade_to_0_8_6i

function upgrade_to_0_8_6i() {
	/* once again, larger fields for OID's and the like */
	db_install_execute("0.8.6i", "ALTER TABLE `poller_item` MODIFY COLUMN `arg1` TEXT;");
	db_install_execute("0.8.6i", "ALTER TABLE `poller_reindex` MODIFY COLUMN `arg1` VARCHAR(255) NOT NULL;");
	db_install_execute("0.8.6i", "ALTER TABLE `host_snmp_cache` MODIFY COLUMN `oid` TEXT NOT NULL;");

	/* let's add more graph tree items for those larger installations */
	db_install_execute("0.8.6i", "ALTER TABLE `graph_tree_items` MODIFY COLUMN `id` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT;");

	/* let's keep track of an important statistical value */
	db_install_execute("0.8.6i", "ALTER TABLE `poller_time` ADD COLUMN `pid` INTEGER UNSIGNED NOT NULL DEFAULT 0 AFTER `id`;");

	/* add some missing information from default/system data input methods */
	/* first we must see if the user was smart enough to add it themselves */
	$snmp_get = db_fetch_cell("SELECT id FROM data_input_fields WHERE data_name='snmp_port' AND data_input_id='1'");
	$snmp_index = db_fetch_cell("SELECT id FROM data_input_fields WHERE data_name='snmp_port' AND data_input_id='2'");

	if ($snmp_index > 0) {
		db_install_execute("0.8.6i", "REPLACE INTO `data_input_fields` VALUES ($snmp_index, 'c1f36ee60c3dc98945556d57f26e475b',2,'SNMP Port','snmp_port','in','',0,'snmp_port','','');");
	}else{
		db_install_execute("0.8.6i", "REPLACE INTO `data_input_fields` VALUES (0, 'c1f36ee60c3dc98945556d57f26e475b',2,'SNMP Port','snmp_port','in','',0,'snmp_port','','');");
	}

	if ($snmp_get > 0) {
		db_install_execute("0.8.6i", "REPLACE INTO `data_input_fields` VALUES ($snmp_get, 'fc64b99742ec417cc424dbf8c7692d36',1,'SNMP Port','snmp_port','in','',0,'snmp_port','','');");
	}else{
		db_install_execute("0.8.6i", "REPLACE INTO `data_input_fields` VALUES (0, 'fc64b99742ec417cc424dbf8c7692d36',1,'SNMP Port','snmp_port','in','',0,'snmp_port','','');");
	}
}
开发者ID:songchin,项目名称:Cacti,代码行数:29,代码来源:0_8_6h_to_0_8_6i.php

示例5: upgrade_to_0_8_7c

function upgrade_to_0_8_7c() {
	/* speed up the UI, missed in 0.8.7b upgrade, avoid failures if index already exists */
	$result = db_fetch_assoc("SHOW INDEX FROM `data_local`") or die (mysql_error());
	$indices = array();
	foreach($result as $index => $arr) {
		$indices[] = $arr["Key_name"];
	}
	if (!in_array('host_id', $indices)) {
		db_install_execute("0.8.7c", "ALTER TABLE `data_local` ADD INDEX `host_id`(`host_id`)");
	}

	$result = db_fetch_assoc("SHOW INDEX FROM `host_snmp_cache`") or die (mysql_error());
	$indices = array();
	foreach($result as $index => $arr) {
		$indices[] = $arr["Key_name"];
	}
	if (!in_array('field_name', $indices)) {
		db_install_execute("0.8.7c", "ALTER TABLE `host_snmp_cache` ADD INDEX `field_name`(`field_name`)");
	}
	if (!in_array('field_value', $indices)) {
		db_install_execute("0.8.7c", "ALTER TABLE `host_snmp_cache` ADD INDEX `field_value`(`field_value`)");
	}

	/* speed up graph automations some more */
	db_install_execute("0.8.7c", "ALTER TABLE `data_input_fields` ADD INDEX `input_output`(`input_output`)");

	/* increase the width of the settings field, but only if MySQL is >= 5 */
	if (substr(db_fetch_cell("SELECT @@version"), 0, 1) >= 5) {
		db_install_execute("0.8.7c", "ALTER TABLE `settings` MODIFY COLUMN `name` VARCHAR(512) NOT NULL DEFAULT ''");
	}

	/* add a default for NOT NULL columns */
	db_install_execute("0.8.7c", "ALTER TABLE `data_local` MODIFY COLUMN `snmp_index` VARCHAR(255) NOT NULL DEFAULT '';");
	db_install_execute("0.8.7c", "ALTER TABLE `graph_local` MODIFY COLUMN `snmp_index` VARCHAR(255) NOT NULL DEFAULT '';");
	db_install_execute("0.8.7c", "ALTER TABLE `graph_templates_graph` MODIFY COLUMN `upper_limit` VARCHAR(20) NOT NULL DEFAULT '0';");
	db_install_execute("0.8.7c", "ALTER TABLE `graph_templates_graph` MODIFY COLUMN `lower_limit` VARCHAR(20) NOT NULL DEFAULT '0';");
	db_install_execute("0.8.7c", "ALTER TABLE `graph_templates_graph` MODIFY COLUMN `scale_log_units` CHAR(2) DEFAULT NULL;");
	db_install_execute("0.8.7c", "ALTER TABLE `host` MODIFY COLUMN `availability` DECIMAL(8,5) NOT NULL DEFAULT '100.00000';");
	db_install_execute("0.8.7c", "ALTER TABLE `host_snmp_cache` MODIFY COLUMN `snmp_index` VARCHAR(255) NOT NULL DEFAULT '';");
	db_install_execute("0.8.7c", "ALTER TABLE `host_snmp_cache` MODIFY COLUMN `oid` TEXT NOT NULL;");
	db_install_execute("0.8.7c", "ALTER TABLE `poller_item` MODIFY COLUMN `snmp_auth_protocol` VARCHAR(5) NOT NULL DEFAULT '';");
	db_install_execute("0.8.7c", "ALTER TABLE `poller_item` MODIFY COLUMN `snmp_priv_passphrase` VARCHAR(200) NOT NULL DEFAULT '';");
	db_install_execute("0.8.7c", "ALTER TABLE `poller_item` MODIFY COLUMN `snmp_priv_protocol` VARCHAR(6) NOT NULL DEFAULT '';");
	db_install_execute("0.8.7c", "ALTER TABLE `poller_item` MODIFY COLUMN `rrd_next_step` MEDIUMINT(8) NOT NULL DEFAULT '0';");
	db_install_execute("0.8.7c", "ALTER TABLE `poller_item` MODIFY COLUMN `arg1` TEXT DEFAULT NULL;");
	db_install_execute("0.8.7c", "ALTER TABLE `poller_reindex` MODIFY COLUMN `arg1` VARCHAR(255) NOT NULL DEFAULT '';");
	db_install_execute("0.8.7c", "ALTER TABLE `user_auth` MODIFY COLUMN `enabled` CHAR(2) NOT NULL DEFAULT 'on';");
	db_install_execute("0.8.7c", "ALTER TABLE `user_log` MODIFY COLUMN `ip` VARCHAR(40) NOT NULL DEFAULT '';");

	/* change size of columns to match current cacti.sql file */
	db_install_execute("0.8.7c", "ALTER TABLE `poller_item` MODIFY COLUMN `rrd_step` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '300';");
	db_install_execute("0.8.7c", "ALTER TABLE `poller_time` MODIFY COLUMN `pid` INT(11) UNSIGNED NOT NULL DEFAULT '0';");

	/* Update deletion verification setting */
	db_install_execute("0.8.7c", "UPDATE settings SET name = 'deletion_verification' WHERE name = 'remove_verification'");

	/* Correct issue where rrd_next_step goes large in a positive way instead of the way it should go */
	db_install_execute("0.8.7c", "ALTER TABLE `poller_item` MODIFY COLUMN `rrd_step` MEDIUMINT(8) NOT NULL DEFAULT 300");
}
开发者ID:songchin,项目名称:Cacti,代码行数:59,代码来源:0_8_7b_to_0_8_7c.php

示例6: upgrade_to_0_8_6g

function upgrade_to_0_8_6g() {
	/* changes for even longer OID's */
	db_install_execute("0.8.6g", "ALTER TABLE `host_snmp_cache` CHANGE `snmp_index` `snmp_index` VARCHAR( 255 ) NOT NULL;");
	db_install_execute("0.8.6g", "ALTER TABLE `data_local` CHANGE `snmp_index` `snmp_index` VARCHAR( 255 ) NOT NULL;");
	db_install_execute("0.8.6g", "ALTER TABLE `graph_local` CHANGE `snmp_index` `snmp_index` VARCHAR( 255 ) NOT NULL;");
	db_install_execute("0.8.6g", "ALTER TABLE `graph_templates_graph` CHANGE `lower_limit` `lower_limit` VARCHAR ( 20 ) DEFAULT '0';");
	db_install_execute("0.8.6g", "ALTER TABLE `graph_templates_graph` CHANGE `upper_limit` `upper_limit` VARCHAR ( 20 ) DEFAULT '0';");
 }
开发者ID:songchin,项目名称:Cacti,代码行数:8,代码来源:0_8_6f_to_0_8_6g.php

示例7: upgrade_to_0_8_2

function upgrade_to_0_8_2() {
	db_install_execute("0.8.2", "ALTER TABLE `data_input_data_cache` ADD `host_id` MEDIUMINT( 8 ) NOT NULL AFTER `local_data_id`;");
	db_install_execute("0.8.2", "ALTER TABLE `host` ADD `disabled` CHAR( 2 ) , ADD `status` TINYINT( 2 ) NOT NULL;");
	db_install_execute("0.8.2", "UPDATE host_snmp_cache set field_name='ifName' where field_name='ifAlias' and snmp_query_id=1;");
	db_install_execute("0.8.2", "UPDATE snmp_query_graph_rrd_sv set text = REPLACE(text,'ifAlias','ifName') where (snmp_query_graph_id=1 or snmp_query_graph_id=13 or snmp_query_graph_id=14 or snmp_query_graph_id=16 or snmp_query_graph_id=9 or snmp_query_graph_id=2 or snmp_query_graph_id=3 or snmp_query_graph_id=4);");
	db_install_execute("0.8.2", "UPDATE snmp_query_graph_sv set text = REPLACE(text,'ifAlias','ifName') where (snmp_query_graph_id=1 or snmp_query_graph_id=13 or snmp_query_graph_id=14 or snmp_query_graph_id=16 or snmp_query_graph_id=9 or snmp_query_graph_id=2 or snmp_query_graph_id=3 or snmp_query_graph_id=4);");
	db_install_execute("0.8.2", "UPDATE host set disabled = '';");
}
开发者ID:songchin,项目名称:Cacti,代码行数:8,代码来源:0_8_1_to_0_8_2.php

示例8: upgrade_to_0_8_6e

function upgrade_to_0_8_6e() {
	/* changes for logarithmic rrd files */
	db_install_execute("0.8.6e", "ALTER TABLE `data_template_rrd` CHANGE `rrd_minimum` `rrd_minimum` VARCHAR( 20 ) NOT NULL;");
	db_install_execute("0.8.6e", "ALTER TABLE `data_template_rrd` CHANGE `rrd_maximum` `rrd_maximum` VARCHAR( 20 ) NOT NULL;");
	db_install_execute("0.8.6e", "ALTER TABLE `graph_templates_graph` CHANGE `upper_limit` `upper_limit` VARCHAR( 20 ) NOT NULL;");
	db_install_execute("0.8.6e", "ALTER TABLE `graph_templates_graph` CHANGE `lower_limit` `lower_limit` VARCHAR( 20 ) NOT NULL;");
	db_install_execute("0.8.6e", "ALTER TABLE `poller_item` ADD `rrd_step` MEDIUMINT( 8 ) UNSIGNED AFTER `rrd_num`, ADD `rrd_next_step` MEDIUMINT( 8 ) AFTER `rrd_step`;");

	/* increase size of ping status field to handle more extensive messages */
	db_install_execute("0.8.6e", "ALTER TABLE `host` CHANGE `status_last_error` `status_last_error` VARCHAR( 100 );");

	/* missing key's to improve Treeview performance */
	db_install_execute("0.8.6e", "ALTER TABLE `graph_local` ADD KEY host_id (host_id), ADD KEY graph_template_id (graph_template_id), ADD KEY snmp_query_id (snmp_query_id), ADD KEY snmp_index (snmp_index);");
	db_install_execute("0.8.6e", "ALTER TABLE `graph_templates_graph` ADD KEY title_cache (title_cache);");
	db_install_execute("0.8.6e", "ALTER TABLE `graph_tree_items` ADD KEY host_id (host_id), ADD KEY local_graph_id (local_graph_id), ADD KEY order_key (order_key);");
	db_install_execute("0.8.6e", "ALTER TABLE `graph_templates` ADD KEY name (name);");
	db_install_execute("0.8.6e", "ALTER TABLE `snmp_query` ADD KEY name (name);");
	db_install_execute("0.8.6e", "ALTER TABLE `host_snmp_cache` ADD KEY snmp_query_id (snmp_query_id);");

	/* missing key's to improve Clear Poller Cache performance */
	db_install_execute("0.8.6e", "ALTER TABLE `snmp_query_graph_rrd` ADD KEY data_template_rrd_id (data_template_rrd_id);");
	db_install_execute("0.8.6e", "ALTER TABLE `snmp_query_graph_rrd` ADD KEY data_template_id (data_template_id);");
	db_install_execute("0.8.6e", "ALTER TABLE `data_template_rrd` ADD KEY local_data_template_rrd_id (local_data_template_rrd_id);");
	db_install_execute("0.8.6e", "ALTER TABLE `data_input_fields` ADD KEY type_code (type_code);");

    /* remove NVA indexes from database */
    db_install_execute("0.8.6e", "ALTER TABLE `cdef` DROP INDEX ID, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `cdef_items` DROP INDEX ID;");
    db_install_execute("0.8.6e", "ALTER TABLE `colors` DROP INDEX ID, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `data_input` DROP INDEX ID, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `data_input_data` DROP INDEX data_input_field_id");
    db_install_execute("0.8.6e", "ALTER TABLE `data_input_fields` DROP INDEX ID, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `data_local` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `data_template` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `data_template_data` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `data_template_rrd` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `graph_local` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `graph_template_input` DROP INDEX id, DROP INDEX id_2, DROP INDEX id_3;");
    db_install_execute("0.8.6e", "ALTER TABLE `graph_templates` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `graph_templates_gprint` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `graph_templates_graph` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `graph_templates_item` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `graph_tree` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `graph_tree_items` DROP INDEX ID, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `host` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `host_template` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `rra` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `settings` DROP INDEX Name, DROP INDEX name_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `settings_graphs` DROP INDEX user_id;");
    db_install_execute("0.8.6e", "ALTER TABLE `snmp_query` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `snmp_query_graph` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `snmp_query_graph_rrd_sv` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `snmp_query_graph_sv` DROP INDEX id, DROP INDEX id_2;");
    db_install_execute("0.8.6e", "ALTER TABLE `user_auth` DROP INDEX ID, DROP INDEX id_2;");
 }
开发者ID:songchin,项目名称:Cacti,代码行数:55,代码来源:0_8_6d_to_0_8_6e.php

示例9: upgrade_to_0_8_6h

function upgrade_to_0_8_6h()
{
    /* changes for ping result times */
    db_install_execute("0.8.6h", "ALTER TABLE `host` MODIFY COLUMN `min_time` DECIMAL(10,5) DEFAULT 9.99999;");
    db_install_execute("0.8.6h", "ALTER TABLE `host` MODIFY COLUMN `max_time` DECIMAL(10,5) DEFAULT 0.00000;");
    db_install_execute("0.8.6h", "ALTER TABLE `host` MODIFY COLUMN `cur_time` DECIMAL(10,5) DEFAULT 0.00000;");
    db_install_execute("0.8.6h", "ALTER TABLE `host` MODIFY COLUMN `avg_time` DECIMAL(10,5) DEFAULT 0.00000;");
    /* Changes to user_log */
    db_install_execute("0.8.6h", "ALTER TABLE `user_log` MODIFY COLUMN `ip` VARCHAR(40);");
    /* Fixes broken graphs that have graph items with legend text but no color assigned */
    db_install_execute("0.8.6h", "UPDATE graph_templates_item SET text_format = '' WHERE local_graph_id <> 0 AND color_id = 0 AND graph_type_id IN(4,5,6,7,8) AND text_format <> '';");
}
开发者ID:BackupTheBerlios,项目名称:odp-svn,代码行数:12,代码来源:0_8_6g_to_0_8_6h.php

示例10: upgrade_to_0_8_8

function upgrade_to_0_8_8()
{
    /* speed up the joins */
    $_columns = array_rekey(db_fetch_assoc("SHOW COLUMNS FROM `poller_item`"), "Field", "Field");
    if (in_array("host_id", $_columns)) {
        db_install_execute("0.8.8", "ALTER TABLE `poller_item` MODIFY COLUMN `host_id` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0'");
        cacti_log(__FUNCTION__ . " upgrade table poller_item", false, "UPGRADE");
    }
    $_keys = array_rekey(db_fetch_assoc("SHOW KEYS FROM `poller_output`"), "Key_name", "Key_name");
    if (in_array("PRIMARY", $_keys)) {
        db_install_execute("0.8.8", "ALTER TABLE `poller_output` DROP PRIMARY KEY");
        cacti_log(__FUNCTION__ . " table poller_output: dropping old PRIMARY KEY", false, "UPGRADE");
    }
    /* now the KEY we want to create is definitively NOT present 
     * MySQL < 5.00.60 requires a different syntax, this was fixed in MySQL 5.00.60, so take care */
    db_install_execute("0.8.8", "ALTER TABLE `poller_output` ADD PRIMARY KEY (`local_data_id`, `rrd_name`, `time`) /*!50060 USING BTREE */");
    cacti_log(__FUNCTION__ . " upgrade table poller_output", false, "UPGRADE");
    /* speed up user management */
    $_keys = array_rekey(db_fetch_assoc("SHOW KEYS FROM `user_log`"), "Key_name", "Key_name");
    if (!in_array("user_id", $_keys)) {
        db_install_execute("0.8.8", "ALTER TABLE `user_log` ADD KEY `user_id` (`user_id`)");
        cacti_log(__FUNCTION__ . " upgrade table user_log", false, "UPGRADE");
    }
    /* Plugin Architecture
     * be prepared to find those data already present
     * in case of upgrade of a cacti+PIA installation */
    $sql = "CREATE TABLE IF NOT EXISTS `plugin_config` (\n\t\t\t\t`id` \t\tint(8) unsigned NOT NULL auto_increment,\n\t\t\t\t`directory` varchar(32) \tNOT NULL default '',\n\t\t\t\t`name` \t\tvarchar(64) \tNOT NULL default '',\n\t\t\t\t`status`\ttinyint(2) \t\tNOT NULL default 0,\n\t\t\t\t`author`\tvarchar(64) \tNOT NULL default '',\n\t\t\t\t`webpage`\tvarchar(255)  \tNOT NULL default '',\n\t\t\t\t`version`\tvarchar(8) \t\tNOT NULL default '',\n\t\t\t\tPRIMARY KEY  (`id`),\n\t\t\t\tKEY `status` (`status`),\n\t\t\t\tKEY `directory` (`directory`)\n\t\t\t\t) ENGINE=MyISAM COMMENT='Plugin Configuration'";
    db_install_execute("0.8.8", $sql);
    cacti_log(__FUNCTION__ . " install table plugin_config", false, "UPGRADE");
    $sql = "CREATE TABLE IF NOT EXISTS `plugin_db_changes` (\n\t\t\t\t`id` \t\tint(10) unsigned NOT NULL auto_increment,\n\t\t\t\t`plugin` \tvarchar(16) \tNOT NULL default '',\n\t\t\t\t`table` \tvarchar(64) \tNOT NULL default '',\n\t\t\t\t`column`\tvarchar(64) \tNOT NULL default '',\n\t\t\t\t`method` \tvarchar(16) \tNOT NULL default '',\n\t\t\t\tPRIMARY KEY  (`id`),\n\t\t\t\tKEY `plugin` (`plugin`),\n\t\t\t\tKEY `method` (`method`)\n\t\t\t\t) ENGINE=MyISAM COMMENT='Plugin Database Changes'";
    db_install_execute("0.8.8", $sql);
    cacti_log(__FUNCTION__ . " install table plugin_db_changes", false, "UPGRADE");
    $sql = "CREATE TABLE IF NOT EXISTS `plugin_hooks` (\n\t\t\t\t`id` \t\tint(8) unsigned NOT NULL auto_increment,\n\t\t\t\t`name` \t\tvarchar(32) \tNOT NULL default '',\n\t\t\t\t`hook` \t\tvarchar(64) \tNOT NULL default '',\n\t\t\t\t`file`\t\tvarchar(255) \tNOT NULL default '',\n\t\t\t\t`function` \tvarchar(128) \tNOT NULL default '',\n\t\t\t\t`status`\tint(8) \t\t\tNOT NULL default 0,\n\t\t\t\tPRIMARY KEY  (`id`),\n\t\t\t\tKEY `hook` (`hook`),\n\t\t\t\tKEY `status` (`status`)\n\t\t\t\t) ENGINE=MyISAM COMMENT='Plugin Hooks'";
    db_install_execute("0.8.8", $sql);
    cacti_log(__FUNCTION__ . " install table plugin_hooks", false, "UPGRADE");
    $sql = "CREATE TABLE IF NOT EXISTS `plugin_realms` (\n\t\t\t\t`id` \t\tint(8) unsigned NOT NULL auto_increment,\n\t\t\t\t`plugin` \tvarchar(32) \tNOT NULL default '',\n\t\t\t\t`file`\t\ttext\t\t \tNOT NULL,\n\t\t\t\t`display` \tvarchar(64) \tNOT NULL default '',\n\t\t\t\tPRIMARY KEY  (`id`),\n\t\t\t\tKEY `plugin` (`plugin`)\n\t\t\t\t) ENGINE=MyISAM COMMENT='Plugin Realms'";
    db_install_execute("0.8.8", $sql);
    cacti_log(__FUNCTION__ . " install table plugin_realms", false, "UPGRADE");
    /* fill initial data into plugin tables
     * be prepared to find those data already present
     * in case of upgrade of a cacti+PIA installation */
    db_install_execute("0.8.8", "REPLACE INTO `plugin_realms` VALUES (1, 'internal', 'plugins.php', 'Plugin Management')");
    db_install_execute("0.8.8", "REPLACE INTO `plugin_hooks` VALUES (1, 'internal', 'config_arrays', '', 'plugin_config_arrays', 1)");
    db_install_execute("0.8.8", "REPLACE INTO `plugin_hooks` VALUES (2, 'internal', 'draw_navigation_text', '', 'plugin_draw_navigation_text', 1)");
    /* allow admin user to access Plugin Management */
    db_install_execute("0.8.8", "REPLACE INTO user_auth_realm VALUES (101,1)");
    /* create index on data_template_data on data_input_id */
    $_keys = array_rekey(db_fetch_assoc("SHOW KEYS FROM `data_template_data`"), "Key_name", "Key_name");
    if (!in_array("data_input_id", $_keys)) {
        db_install_execute("0.8.8", "ALTER TABLE `data_template_data` ADD KEY `data_input_id` (`data_input_id`)");
        cacti_log(__FUNCTION__ . " upgrade table data_template_data", false, "UPGRADE");
    }
}
开发者ID:andrei1489,项目名称:cacti,代码行数:53,代码来源:0_8_7i_to_0_8_8.php

示例11: upgrade_to_0_8_1

function upgrade_to_0_8_1()
{
    db_install_execute("0.8.1", "ALTER TABLE user_log add user_id mediumint(8) not null after username;");
    db_install_execute("0.8.1", "ALTER TABLE user_log change time time datetime not null;");
    db_install_execute("0.8.1", "ALTER TABLE user_log drop primary key;");
    db_install_execute("0.8.1", "ALTER TABLE user_log add primary key (username, user_id, time);");
    db_install_execute("0.8.1", "ALTER TABLE user_auth add realm mediumint(8) not null after password;");
    db_install_execute("0.8.1", "UPDATE user_auth set realm = 1 where full_name='ldap user';");
    $_src = db_fetch_assoc("select id, username from user_auth");
    if (sizeof($_src) > 0) {
        foreach ($_src as $item) {
            db_install_execute("0.8.1", "UPDATE user_log set user_id = " . $item["id"] . " where username = '" . $item["username"] . "';");
        }
    }
}
开发者ID:resmon,项目名称:resmon-cacti,代码行数:15,代码来源:0_8_to_0_8_1.php

示例12: upgrade_to_0_8_3

function upgrade_to_0_8_3()
{
    include "../lib/template.php";
    db_install_execute("0.8.3", "ALTER TABLE `user_auth` CHANGE `graph_policy` `policy_graphs` TINYINT( 1 ) UNSIGNED DEFAULT '1' NOT NULL;");
    db_install_execute("0.8.3", "ALTER TABLE `user_auth` ADD `policy_trees` TINYINT( 1 ) UNSIGNED DEFAULT '1' NOT NULL, ADD `policy_hosts` TINYINT( 1 ) UNSIGNED DEFAULT '1' NOT NULL, ADD `policy_graph_templates` TINYINT( 1 ) UNSIGNED DEFAULT '1' NOT NULL;");
    db_install_execute("0.8.3", "ALTER TABLE `graph_tree_items` ADD `host_id` MEDIUMINT( 8 ) UNSIGNED NOT NULL AFTER `title`;");
    db_install_execute("0.8.3", "ALTER TABLE `rra` ADD `timespan` INT( 12 ) UNSIGNED NOT NULL;");
    db_install_execute("0.8.3", "UPDATE rra set timespan=(rows*steps*144);");
    db_install_execute("0.8.3", "CREATE TABLE `user_auth_perms` (\n\t\t`user_id` mediumint(8) unsigned NOT NULL default '0',\n\t\t`item_id` mediumint(8) unsigned NOT NULL default '0',\n\t\t`type` tinyint(2) unsigned NOT NULL default '0',\n\t\tPRIMARY KEY  (`user_id`,`item_id`,`type`),\n\t\tKEY `user_id` (`user_id`,`type`)\n\t\t) TYPE=MyISAM;");
    $auth_graph = db_fetch_assoc("select user_id,local_graph_id from user_auth_graph");
    /* update to new 'user_auth_perms' table */
    if (sizeof($auth_graph) > 0) {
        foreach ($auth_graph as $item) {
            db_install_execute("0.8.3", "replace into user_auth_perms (user_id,item_id,type) values (" . $item["user_id"] . "," . $item["local_graph_id"] . ",1);");
        }
    }
    $auth_tree = db_fetch_assoc("select user_id,tree_id from user_auth_tree");
    /* update to new 'user_auth_perms' table */
    if (sizeof($auth_tree) > 0) {
        foreach ($auth_tree as $item) {
            db_install_execute("0.8.3", "replace into user_auth_perms (user_id,item_id,type) values (" . $item["user_id"] . "," . $item["tree_id"] . ",2);");
        }
    }
    $users = db_fetch_assoc("select id from user_auth");
    /* default all current users to tree view mode 1 (single pane) */
    if (sizeof($users) > 0) {
        foreach ($users as $item) {
            db_install_execute("0.8.3", "replace into settings_graphs (user_id,name,value) values (" . $item["id"] . ",'default_tree_view_mode',1);");
        }
    }
    /* drop unused tables */
    db_install_execute("0.8.3", "DROP TABLE `user_auth_graph`;");
    db_install_execute("0.8.3", "DROP TABLE `user_auth_tree`;");
    db_install_execute("0.8.3", "DROP TABLE `user_auth_hosts`;");
    /* bug#72 */
    db_install_execute("0.8.3", "UPDATE graph_templates_item set cdef_id=15 where id=25;");
    db_install_execute("0.8.3", "UPDATE graph_templates_item set cdef_id=15 where id=26;");
    db_install_execute("0.8.3", "UPDATE graph_templates_item set cdef_id=15 where id=27;");
    db_install_execute("0.8.3", "UPDATE graph_templates_item set cdef_id=15 where id=28;");
    push_out_graph_item(25);
    push_out_graph_item(26);
    push_out_graph_item(27);
    push_out_graph_item(28);
    /* too many people had problems with the poller cache in 0.8.2a... */
    db_install_execute("0.8.3", "DROP TABLE `data_input_data_cache`");
    db_install_execute("0.8.3", "CREATE TABLE `data_input_data_cache` (\n\t\t`local_data_id` mediumint(8) unsigned NOT NULL default '0',\n\t\t`host_id` mediumint(8) NOT NULL default '0',\n\t\t`data_input_id` mediumint(8) unsigned NOT NULL default '0',\n\t\t`action` tinyint(2) NOT NULL default '1',\n\t\t`command` varchar(255) NOT NULL default '',\n\t\t`management_ip` varchar(15) NOT NULL default '',\n\t\t`snmp_community` varchar(100) NOT NULL default '',\n\t\t`snmp_version` tinyint(1) NOT NULL default '0',\n\t\t`snmp_username` varchar(50) NOT NULL default '',\n\t\t`snmp_password` varchar(50) NOT NULL default '',\n\t\t`rrd_name` varchar(19) NOT NULL default '',\n\t\t`rrd_path` varchar(255) NOT NULL default '',\n\t\t`rrd_num` tinyint(2) unsigned NOT NULL default '0',\n\t\t`arg1` varchar(255) default NULL,\n\t\t`arg2` varchar(255) default NULL,\n\t\t`arg3` varchar(255) default NULL,\n\t\tPRIMARY KEY  (`local_data_id`,`rrd_name`),\n\t\tKEY `local_data_id` (`local_data_id`)\n\t\t) TYPE=MyISAM;");
}
开发者ID:songchin,项目名称:Cacti,代码行数:47,代码来源:0_8_2a_to_0_8_3.php

示例13: upgrade_to_0_8_5

function upgrade_to_0_8_5() {
	/* bug#109 */
	db_install_execute("0.8.5", "UPDATE host_snmp_cache set field_name='ifDescr' where field_name='ifDesc' and snmp_query_id=1;");
	db_install_execute("0.8.5", "UPDATE snmp_query_graph_rrd_sv set text = REPLACE(text,'ifDesc','ifDescr') where (snmp_query_graph_id=1 or snmp_query_graph_id=13 or snmp_query_graph_id=14 or snmp_query_graph_id=16 or snmp_query_graph_id=9 or snmp_query_graph_id=2 or snmp_query_graph_id=3 or snmp_query_graph_id=4 or snmp_query_graph_id=20 or snmp_query_graph_id=21 or snmp_query_graph_id=22);");
	db_install_execute("0.8.5", "UPDATE snmp_query_graph_sv set text = REPLACE(text,'ifDesc','ifDescr') where (snmp_query_graph_id=1 or snmp_query_graph_id=13 or snmp_query_graph_id=14 or snmp_query_graph_id=16 or snmp_query_graph_id=9 or snmp_query_graph_id=2 or snmp_query_graph_id=3 or snmp_query_graph_id=4 or snmp_query_graph_id=20 or snmp_query_graph_id=21 or snmp_query_graph_id=22);");

	db_install_execute("0.8.5", "UPDATE data_template_data set name = REPLACE(name,'ifDesc','ifDescr') where data_template_id=1;");
	db_install_execute("0.8.5", "UPDATE data_template_data set name = REPLACE(name,'ifDesc','ifDescr') where data_template_id=2;");
	db_install_execute("0.8.5", "UPDATE data_template_data set name = REPLACE(name,'ifDesc','ifDescr') where data_template_id=38;");
	db_install_execute("0.8.5", "UPDATE data_template_data set name = REPLACE(name,'ifDesc','ifDescr') where data_template_id=39;");
	db_install_execute("0.8.5", "UPDATE data_template_data set name = REPLACE(name,'ifDesc','ifDescr') where data_template_id=40;");
	db_install_execute("0.8.5", "UPDATE data_template_data set name = REPLACE(name,'ifDesc','ifDescr') where data_template_id=41;");

	$data_templates = db_fetch_assoc("select id from data_template_data where (data_template_id=1 or data_template_id=2 or data_template_id=38 or data_template_id=39 or data_template_id=40 or data_template_id=41);");

	if (sizeof($data_templates) > 0) {
	foreach ($data_templates as $item) {
		db_install_execute("0.8.5", "UPDATE data_input_data set value='ifDescr' where value='ifDesc' and data_template_data_id=" . $item["id"] . ";");
	}
	}

	db_install_execute("0.8.5", "UPDATE graph_templates_graph set title = REPLACE(title,'ifDesc','ifDescr') where graph_template_id=22;");
	db_install_execute("0.8.5", "UPDATE graph_templates_graph set title = REPLACE(title,'ifDesc','ifDescr') where graph_template_id=24;");
	db_install_execute("0.8.5", "UPDATE graph_templates_graph set title = REPLACE(title,'ifDesc','ifDescr') where graph_template_id=1;");
	db_install_execute("0.8.5", "UPDATE graph_templates_graph set title = REPLACE(title,'ifDesc','ifDescr') where graph_template_id=2;");
	db_install_execute("0.8.5", "UPDATE graph_templates_graph set title = REPLACE(title,'ifDesc','ifDescr') where graph_template_id=31;");
	db_install_execute("0.8.5", "UPDATE graph_templates_graph set title = REPLACE(title,'ifDesc','ifDescr') where graph_template_id=32;");
	db_install_execute("0.8.5", "UPDATE graph_templates_graph set title = REPLACE(title,'ifDesc','ifDescr') where graph_template_id=25;");
	db_install_execute("0.8.5", "UPDATE graph_templates_graph set title = REPLACE(title,'ifDesc','ifDescr') where graph_template_id=33;");
	db_install_execute("0.8.5", "UPDATE graph_templates_graph set title = REPLACE(title,'ifDesc','ifDescr') where graph_template_id=23;");

	db_install_execute("0.8.5", "CREATE TABLE `host_graph` (`host_id` mediumint(8) unsigned NOT NULL default '0', `graph_template_id` mediumint(8) unsigned NOT NULL default '0', PRIMARY KEY  (`host_id`,`graph_template_id`)) TYPE=MyISAM;");

	/* typo */
	db_install_execute("0.8.5", "UPDATE settings set name='snmp_version' where name='smnp_version';");

	/* allow 'Unit Exponent Value' = 0 */
	db_install_execute("0.8.5", "ALTER TABLE `graph_templates_graph` CHANGE `unit_exponent_value` `unit_exponent_value` VARCHAR( 5 ) NOT NULL;");
	db_install_execute("0.8.5", "UPDATE graph_templates_graph set unit_exponent_value='' where unit_exponent_value='0';");

	/* allow larger rrd steps */
	db_install_execute("0.8.5", "ALTER TABLE `data_template_data` CHANGE `rrd_step` `rrd_step` MEDIUMINT( 8 ) UNSIGNED DEFAULT '0' NOT NULL;");
}
开发者ID:songchin,项目名称:Cacti,代码行数:43,代码来源:0_8_4_to_0_8_5.php

示例14: upgrade_to_0_8_7h

function upgrade_to_0_8_7h()
{
    global $config;
    require_once $config["base_path"] . "/lib/poller.php";
    /* speed up the reindexing */
    $_columns = array_rekey(db_fetch_assoc("SHOW COLUMNS FROM host_snmp_cache"), "Field", "Field");
    if (!in_array("present", $_columns)) {
        db_install_execute("0.8.7h", "ALTER TABLE host_snmp_cache ADD COLUMN present tinyint NOT NULL DEFAULT '1' AFTER `oid`");
        db_install_execute("0.8.7h", "ALTER TABLE host_snmp_cache ADD INDEX present (present)");
        cacti_log(__FUNCTION__ . " upgrade table host_snmp_cache", false, "UPGRADE");
    }
    $_columns = array_rekey(db_fetch_assoc("SHOW COLUMNS FROM poller_item"), "Field", "Field");
    if (!in_array("present", $_columns)) {
        db_install_execute("0.8.7h", "ALTER TABLE poller_item ADD COLUMN present tinyint NOT NULL DEFAULT '1' AFTER `action`");
        db_install_execute("0.8.7h", "ALTER TABLE poller_item ADD INDEX present (present)");
        cacti_log(__FUNCTION__ . " upgrade table poller_item", false, "UPGRADE");
    }
    $_columns = array_rekey(db_fetch_assoc("SHOW COLUMNS FROM poller_reindex"), "Field", "Field");
    if (!in_array("present", $_columns)) {
        db_install_execute("0.8.7h", "ALTER TABLE poller_reindex ADD COLUMN present tinyint NOT NULL DEFAULT '1' AFTER `action`");
        db_install_execute("0.8.7h", "ALTER TABLE poller_reindex ADD INDEX present (present)");
        cacti_log(__FUNCTION__ . " upgrade table poller_reindex", false, "UPGRADE");
    }
    $_columns = array_rekey(db_fetch_assoc("SHOW COLUMNS FROM host"), "Field", "Field");
    if (!in_array("device_threads", $_columns)) {
        db_install_execute("0.8.7h", "ALTER TABLE host ADD COLUMN device_threads tinyint(2) unsigned NOT NULL DEFAULT '1' AFTER max_oids;");
        cacti_log(__FUNCTION__ . " upgrade table host", false, "UPGRADE");
    }
    $_keys = array_rekey(db_fetch_assoc("SHOW KEYS FROM data_template_rrd"), "Key_name", "Key_name");
    if (!in_array("duplicate_dsname_contraint", $_keys)) {
        db_install_execute("0.8.7h", "ALTER TABLE `data_template_rrd` ADD UNIQUE INDEX `duplicate_dsname_contraint` (`local_data_id`, `data_source_name`, `data_template_id`)");
        cacti_log(__FUNCTION__ . " upgrade table data_template_rrd", false, "UPGRADE");
    }
    /* update the reindex cache, as we now introduced more options for "index count changed" */
    $command_string = read_config_option("path_php_binary");
    $extra_args = "-q \"" . $config["base_path"] . "/cli/poller_reindex_hosts.php\" --id=all";
    exec_background($command_string, "{$extra_args}");
    cacti_log(__FUNCTION__ . " running {$command_string} {$extra_args}", false, "UPGRADE");
}
开发者ID:andrei1489,项目名称:cacti,代码行数:39,代码来源:0_8_7g_to_0_8_7h.php

示例15: upgrade_to_0_8_7

function upgrade_to_0_8_7()
{
    /* add slope mode as an option */
    db_install_execute("0.8.7", "ALTER TABLE `graph_templates_graph` ADD COLUMN `t_slope_mode` CHAR(2) DEFAULT 0 AFTER `vertical_label`, ADD COLUMN `slope_mode` CHAR(2) DEFAULT 'on' AFTER `t_slope_mode`;");
    /* change the width of the last error field */
    db_install_execute("0.8.7", "ALTER TABLE `host` MODIFY COLUMN `status_last_error` VARCHAR(255);");
    /* fix rrd min and max values for data templates */
    db_install_execute("0.8.7", "ALTER TABLE `data_template_rrd` MODIFY COLUMN `rrd_maximum` VARCHAR(20) NOT NULL DEFAULT 0, MODIFY COLUMN `rrd_minimum` VARCHAR(20) NOT NULL DEFAULT 0");
    /* speed up the poller */
    db_install_execute("0.8.7", "ALTER TABLE `host` ADD INDEX `disabled`(`disabled`)");
    db_install_execute("0.8.7", "ALTER TABLE `poller_item` ADD INDEX `rrd_next_step`(`rrd_next_step`)");
    /* speed up the UI */
    db_install_execute("0.8.7", "ALTER TABLE `poller_item` ADD INDEX `action`(`action`)");
    db_install_execute("0.8.7", "ALTER TABLE `user_auth` ADD INDEX `username`(`username`)");
    db_install_execute("0.8.7", "ALTER TABLE `user_auth` ADD INDEX `realm`(`realm`)");
    db_install_execute("0.8.7", "ALTER TABLE `user_log` ADD INDEX `username`(`username`)");
    db_install_execute("0.8.7", "ALTER TABLE `data_input` ADD INDEX `name`(`name`)");
    /* Add enable/disable to users */
    db_install_execute("0.8.7", "ALTER TABLE `user_auth` ADD COLUMN `enabled` CHAR(2) DEFAULT 'on'");
    db_install_execute("0.8.7", "ALTER TABLE `user_auth` ADD INDEX `enabled`(`enabled`)");
    /* add additional fields to the host table */
    db_install_execute("0.8.7", "ALTER TABLE `host` ADD COLUMN `availability_method` SMALLINT(5) UNSIGNED NOT NULL default '2' AFTER `snmp_timeout`");
    db_install_execute("0.8.7", "ALTER TABLE `host` ADD COLUMN `ping_method` SMALLINT(5) UNSIGNED default '0' AFTER `availability_method`");
    db_install_execute("0.8.7", "ALTER TABLE `host` ADD COLUMN `ping_port` INT(12) UNSIGNED default '0' AFTER `ping_method`");
    db_install_execute("0.8.7", "ALTER TABLE `host` ADD COLUMN `ping_timeout` INT(12) UNSIGNED default '500' AFTER `ping_port`");
    db_install_execute("0.8.7", "ALTER TABLE `host` ADD COLUMN `ping_retries` INT(12) UNSIGNED default '2' AFTER `ping_timeout`");
    db_install_execute("0.8.7", "ALTER TABLE `host` ADD COLUMN `max_oids` INT(12) UNSIGNED default '10' AFTER `ping_retries`");
    db_install_execute("0.8.7", "ALTER TABLE `host` ADD COLUMN `notes` TEXT AFTER `hostname`");
    db_install_execute("0.8.7", "ALTER TABLE `host` ADD COLUMN `snmp_auth_protocol` CHAR(5) default '' AFTER `snmp_password`");
    db_install_execute("0.8.7", "ALTER TABLE `host` ADD COLUMN `snmp_priv_passphrase` varchar(200) default '' AFTER `snmp_auth_protocol`");
    db_install_execute("0.8.7", "ALTER TABLE `host` ADD COLUMN `snmp_priv_protocol` CHAR(6) default '' AFTER `snmp_priv_passphrase`");
    db_install_execute("0.8.7", "ALTER TABLE `host` ADD COLUMN `snmp_context` VARCHAR(64) default '' AFTER `snmp_priv_protocol`");
    /* additional poller items fields required */
    db_install_execute("0.8.7", "ALTER TABLE `poller_item` ADD COLUMN `snmp_auth_protocol` CHAR(5) default '' AFTER `snmp_password`");
    db_install_execute("0.8.7", "ALTER TABLE `poller_item` ADD COLUMN `snmp_priv_passphrase` varchar(200) default '' AFTER `snmp_auth_protocol`");
    db_install_execute("0.8.7", "ALTER TABLE `poller_item` ADD COLUMN `snmp_priv_protocol` CHAR(6) default '' AFTER `snmp_priv_passphrase`");
    db_install_execute("0.8.7", "ALTER TABLE `poller_item` ADD COLUMN `snmp_context` VARCHAR(64) default '' AFTER `snmp_priv_protocol`");
    /* Convert to new authentication system */
    $global_auth = "on";
    $global_auth_db = db_fetch_row("SELECT value FROM settings WHERE name = 'global_auth'");
    if (sizeof($global_auth_db)) {
        $global_auth = $global_auth_db["value"];
    }
    $ldap_enabled = "";
    $ldap_enabled_db = db_fetch_row("SELECT value FROM settings WHERE name = 'ldap_enabled'");
    if (sizeof($ldap_enabled_db)) {
        $ldap_enabled = $ldap_enabled_db["value"];
    }
    if ($global_auth == "on") {
        if ($ldap_enabled == "on") {
            db_install_execute("0.8.7", "INSERT INTO settings VALUES ('auth_method','3')");
        } else {
            db_install_execute("0.8.7", "INSERT INTO settings VALUES ('auth_method','1')");
        }
    } else {
        db_install_execute("0.8.7", "INSERT INTO settings VALUES ('auth_method','0')");
    }
    db_install_execute("0.8.7", "UPDATE `settings` SET value = '0' WHERE name = 'guest_user' and value = ''");
    db_install_execute("0.8.7", "UPDATE `settings` SET name = 'user_template' WHERE name = 'ldap_template'");
    db_install_execute("0.8.7", "UPDATE `settings` SET value = '0' WHERE name = 'user_template' and value = ''");
    db_install_execute("0.8.7", "DELETE FROM `settings` WHERE name = 'global_auth'");
    db_install_execute("0.8.7", "DELETE FROM `settings` WHERE name = 'ldap_enabled'");
    /* host settings for availability */
    $ping_method = read_config_option("ping_method");
    $ping_retries = read_config_option("ping_retries");
    $ping_timeout = read_config_option("ping_timeout");
    $availability_method = read_config_option("availability_method");
    $hosts = db_fetch_assoc("SELECT id, snmp_community, snmp_version FROM host");
    if (sizeof($hosts)) {
        foreach ($hosts as $host) {
            if (strlen($host["snmp_community"] != 0)) {
                if ($host["snmp_version"] == "3") {
                    if ($availability_method == AVAIL_SNMP) {
                        db_install_execute("0.8.7", "UPDATE host SET snmp_priv_protocol='[None]', snmp_auth_protocol='MD5', availability_method=" . AVAIL_SNMP . ", ping_method=" . PING_UDP . ",ping_timeout=" . $ping_timeout . ", ping_retries=" . $ping_retries . " WHERE id=" . $host["id"]);
                    } else {
                        if ($availability_method == AVAIL_SNMP_AND_PING) {
                            if ($ping_method == PING_ICMP) {
                                db_install_execute("0.8.7", "UPDATE host SET snmp_priv_protocol='[None]', availability_method=" . AVAIL_SNMP_AND_PING . ", ping_method=" . $ping_method . ", ping_timeout=" . $ping_timeout . ", ping_retries=" . $ping_retries . " WHERE id=" . $host["id"]);
                            } else {
                                db_install_execute("0.8.7", "UPDATE host SET snmp_priv_protocol='[None]', availability_method=" . AVAIL_SNMP_AND_PING . ", ping_method=" . $ping_method . ", ping_port=33439, ping_timeout=" . $ping_timeout . ", ping_retries=" . $ping_retries . " WHERE id=" . $host["id"]);
                            }
                        } else {
                            if ($ping_method == PING_ICMP) {
                                db_install_execute("0.8.7", "UPDATE host SET snmp_priv_protocol='[None]', availability_method=" . AVAIL_PING . ", ping_method=" . $ping_method . ", ping_timeout=" . $ping_timeout . ", ping_retries=" . $ping_retries . " WHERE id=" . $host["id"]);
                            } else {
                                db_install_execute("0.8.7", "UPDATE host SET snmp_priv_protocol='[None]', availability_method=" . AVAIL_PING . ", ping_method=" . $ping_method . ", ping_port=33439, ping_timeout=" . $ping_timeout . ", ping_retries=" . $ping_retries . " WHERE id=" . $host["id"]);
                            }
                        }
                    }
                } else {
                    if ($availability_method == AVAIL_SNMP) {
                        db_install_execute("0.8.7", "UPDATE host SET availability_method=" . AVAIL_SNMP . ", ping_method=" . PING_UDP . ",ping_timeout=" . $ping_timeout . ", ping_retries=" . $ping_retries . " WHERE id=" . $host["id"]);
                    } else {
                        if ($availability_method == AVAIL_SNMP_AND_PING) {
                            if ($ping_method == PING_ICMP) {
                                db_install_execute("0.8.7", "UPDATE host SET availability_method=" . AVAIL_SNMP_AND_PING . ", ping_method=" . $ping_method . ", ping_timeout=" . $ping_timeout . ", ping_retries=" . $ping_retries . " WHERE id=" . $host["id"]);
                            } else {
                                db_install_execute("0.8.7", "UPDATE host SET availability_method=" . AVAIL_SNMP_AND_PING . ", ping_method=" . $ping_method . ", ping_port=33439, ping_timeout=" . $ping_timeout . ", ping_retries=" . $ping_retries . " WHERE id=" . $host["id"]);
                            }
                        } else {
//.........这里部分代码省略.........
开发者ID:resmon,项目名称:resmon-cacti,代码行数:101,代码来源:0_8_6j_to_0_8_7.php


注:本文中的db_install_execute函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。