]> git.pld-linux.org Git - packages/cacti.git/blame - mysql_5x_strict.patch
- verbosity none is supposed to be mute!
[packages/cacti.git] / mysql_5x_strict.patch
CommitLineData
33bb85a3
ER
1diff -ruBbd cacti-0.8.6h/cacti.sql cacti-0.8.6h-patched/cacti.sql
2--- cacti-0.8.6h/cacti.sql 2006-01-03 22:08:30.000000000 -0500
3+++ cacti-0.8.6h-patched/cacti.sql 2006-01-25 00:16:43.000000000 -0500
fdcfda25
AM
4@@ -1846,7 +1846,7 @@
5 avg_time decimal(10,5) default '0.00000',
6 total_polls int(12) unsigned default '0',
7 failed_polls int(12) unsigned default '0',
8- availability decimal(7,5) NOT NULL default '100.00000',
9+ availability decimal(8,5) NOT NULL default '100.00000',
10 PRIMARY KEY (id)
11 ) TYPE=MyISAM;
12
33bb85a3
ER
13diff -ruBbd cacti-0.8.6h/lib/auth.php cacti-0.8.6h-patched/lib/auth.php
14--- cacti-0.8.6h/lib/auth.php 2006-01-03 22:08:30.000000000 -0500
15+++ cacti-0.8.6h-patched/lib/auth.php 2006-01-25 00:20:48.000000000 -0500
16@@ -40,25 +40,25 @@
17 $user_auth_perms = db_fetch_assoc("select * from user_auth_perms where user_id = '$old_id'");
18 foreach ($user_auth_perms as $row) {
19 $row['user_id'] = $new_id;
20- sql_save($row, 'user_auth_perms', array('user_id', 'item_id', 'type'));
21+ sql_save($row, 'user_auth_perms', array('user_id', 'item_id', 'type'), false);
22 }
23
24 $user_auth_realm = db_fetch_assoc("select * from user_auth_realm where user_id = '$old_id'");
25 foreach ($user_auth_realm as $row) {
26 $row['user_id'] = $new_id;
27- sql_save($row, 'user_auth_realm', array('realm_id', 'user_id'));
28+ sql_save($row, 'user_auth_realm', array('realm_id', 'user_id'), false);
29 }
30
31 $settings_graphs = db_fetch_assoc("select * from settings_graphs where user_id = '$old_id'");
32 foreach ($settings_graphs as $row) {
33 $row['user_id'] = $new_id;
34- sql_save($row, 'settings_graphs', array('user_id', 'name'));
35+ sql_save($row, 'settings_graphs', array('user_id', 'name'), false);
36 }
37
38 $settings_tree = db_fetch_assoc("select * from settings_tree where user_id = '$old_id'");
39 foreach ($settings_tree as $row) {
40 $row['user_id'] = $new_id;
41- sql_save($row, 'settings_tree', array('user_id', 'graph_tree_item_id'));
42+ sql_save($row, 'settings_tree', array('user_id', 'graph_tree_item_id'), false);
43 }
44 }
45
46diff -ruBbd cacti-0.8.6h/lib/database.php cacti-0.8.6h-patched/lib/database.php
47--- cacti-0.8.6h/lib/database.php 2006-01-03 22:08:30.000000000 -0500
48+++ cacti-0.8.6h-patched/lib/database.php 2006-01-25 00:16:43.000000000 -0500
fdcfda25
AM
49@@ -214,14 +214,14 @@
50 @arg $table_name - the name of the table to make the replacement in
51 @arg $key_cols - the primary key(s)
52 @returns - the auto incriment id column (if applicable) */
53-function sql_save($array_items, $table_name, $key_cols = "id") {
54+function sql_save($array_items, $table_name, $key_cols = "id", $autoinc = TRUE) {
55 global $cnn_id;
56
57 while (list ($key, $value) = each ($array_items)) {
58 $array_items[$key] = "\"" . sql_sanitize($value) . "\"";
59 }
60
61- if (!$cnn_id->Replace($table_name, $array_items, $key_cols, false)) { return 0; }
62+ if (!$cnn_id->Replace($table_name, $array_items, $key_cols, FALSE, $autoinc)) { return 0; }
63
64 /* get the last AUTO_ID and return it */
65 if ($cnn_id->Insert_ID() == "0") {
33bb85a3
ER
66diff -ruBbd cacti-0.8.6h/lib/import.php cacti-0.8.6h-patched/lib/import.php
67--- cacti-0.8.6h/lib/import.php 2006-01-03 22:08:30.000000000 -0500
68+++ cacti-0.8.6h-patched/lib/import.php 2006-01-25 00:21:16.000000000 -0500
69@@ -341,7 +341,7 @@
70 $save["t_value"] = $item_array["t_value"];
71 $save["value"] = addslashes(xml_character_decode($item_array["value"]));
72
73- sql_save($save, "data_input_data", array("data_template_data_id", "data_input_field_id"));
74+ sql_save($save, "data_input_data", array("data_template_data_id", "data_input_field_id"), false);
75 }
76 }
77
78@@ -419,7 +419,7 @@
79 $save["data_template_rrd_id"] = resolve_hash_to_id($sub_item_array["data_template_rrd_id"], $hash_cache);
80 $save["snmp_field_name"] = $sub_item_array["snmp_field_name"];
81
82- sql_save($save, "snmp_query_graph_rrd", array("snmp_query_graph_id", "data_template_id", "data_template_rrd_id"));
83+ sql_save($save, "snmp_query_graph_rrd", array("snmp_query_graph_id", "data_template_id", "data_template_rrd_id"), false);
84 }
85 }
86
87diff -ruBbd cacti-0.8.6h/lib/template.php cacti-0.8.6h-patched/lib/template.php
88--- cacti-0.8.6h/lib/template.php 2006-01-03 22:08:30.000000000 -0500
89+++ cacti-0.8.6h-patched/lib/template.php 2006-01-25 00:16:43.000000000 -0500
90@@ -643,10 +643,16 @@
fdcfda25
AM
91
92 /* if there are no '|' characters, all of the substitutions were successful */
93 if (!strstr($subs_string, "|query")) {
94+ if (sizeof(db_fetch_row("show columns from data_template_data like '" . $suggested_value["field_name"] . "'"))) {
95 db_execute("update data_template_data set " . $suggested_value["field_name"] . "='" . addslashes($suggested_value["text"]) . "' where local_data_id=" . $cache_array["local_data_id"]{$data_template["id"]});
96+ }
97
98 /* once we find a working value, stop */
99 $suggested_values_ds{$data_template["id"]}{$suggested_value["field_name"]} = true;
100+
101+ if (sizeof(db_fetch_row("show columns from data_template_rrd like '" . $suggested_value["field_name"] . "'"))) {
102+ db_execute("update data_template_rrd set " . $suggested_value["field_name"] . "='" . $subs_string . "' where local_data_id=" . $cache_array["local_data_id"]{$data_template["id"]});
103+ }
104 }
105 }
106 }
This page took 0.088457 seconds and 4 git commands to generate.