1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
|
/*
** Zabbix
** Copyright (C) 2001-2019 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#include "common.h"
#include "db.h"
#include "dbupgrade.h"
#include "zbxtasks.h"
#include "zbxregexp.h"
#include "log.h"
extern unsigned char program_type;
/*
* 4.0 development database patches
*/
#ifndef HAVE_SQLITE3
static int DBpatch_3050000(void)
{
const ZBX_FIELD field = {"proxy_address", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBadd_field("hosts", &field);
}
static int DBpatch_3050001(void)
{
DB_RESULT result;
DB_ROW row;
int ret = FAIL;
/* type : 'problem' - WIDGET_PROBLEMS */
result = DBselect(
"select wf.widgetid,wf.name"
" from widget w,widget_field wf"
" where w.widgetid=wf.widgetid"
" and w.type='problems'"
" and wf.name like 'tags.tag.%%'");
while (NULL != (row = DBfetch(result)))
{
const char *p;
int index;
zbx_uint64_t widget_fieldid;
if (NULL == (p = strrchr(row[1], '.')) || SUCCEED != is_uint31(p + 1, &index))
continue;
widget_fieldid = DBget_maxid_num("widget_field", 1);
/* type : 0 - ZBX_WIDGET_FIELD_TYPE_INT32 */
/* value_int : 0 - TAG_OPERATOR_LIKE */
if (ZBX_DB_OK > DBexecute(
"insert into widget_field (widget_fieldid,widgetid,type,name,value_int)"
"values (" ZBX_FS_UI64 ",%s,0,'tags.operator.%d',0)", widget_fieldid, row[0], index)) {
goto clean;
}
}
ret = SUCCEED;
clean:
DBfree_result(result);
return ret;
}
static int DBpatch_3050004(void)
{
const ZBX_FIELD field = {"name", "", NULL, NULL, 2048, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
if (SUCCEED != DBadd_field("events", &field))
return FAIL;
return SUCCEED;
}
static int DBpatch_3050005(void)
{
const ZBX_FIELD field = {"name", "", NULL, NULL, 2048, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
if (SUCCEED != DBadd_field("problem", &field))
return FAIL;
return SUCCEED;
}
#define ZBX_DEFAULT_INTERNAL_TRIGGER_EVENT_NAME "Cannot calculate trigger expression."
#define ZBX_DEFAULT_INTERNAL_ITEM_EVENT_NAME "Cannot obtain item value."
static int DBpatch_3050008(void)
{
int res;
char *trdefault = (char *)ZBX_DEFAULT_INTERNAL_TRIGGER_EVENT_NAME;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
res = DBexecute("update events set name='%s' where source=%d and object=%d and value=%d", trdefault,
EVENT_SOURCE_INTERNAL, EVENT_OBJECT_TRIGGER, EVENT_STATUS_PROBLEM);
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050009(void)
{
int res;
char *trdefault = (char *)ZBX_DEFAULT_INTERNAL_TRIGGER_EVENT_NAME;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
res = DBexecute("update problem set name='%s' where source=%d and object=%d ", trdefault,
EVENT_SOURCE_INTERNAL, EVENT_OBJECT_TRIGGER);
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050010(void)
{
int res;
char *itdefault = (char *)ZBX_DEFAULT_INTERNAL_ITEM_EVENT_NAME;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
res = DBexecute("update events set name='%s' where source=%d and object=%d and value=%d", itdefault,
EVENT_SOURCE_INTERNAL, EVENT_OBJECT_ITEM, EVENT_STATUS_PROBLEM);
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050011(void)
{
int res;
char *itdefault = (char *)ZBX_DEFAULT_INTERNAL_ITEM_EVENT_NAME;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
res = DBexecute("update problem set name='%s' where source=%d and object=%d", itdefault,
EVENT_SOURCE_INTERNAL, EVENT_OBJECT_ITEM);
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050012(void)
{
int res;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
res = DBexecute("update profiles set idx='web.problem.filter.name' where idx='web.problem.filter.problem'");
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050013(void)
{
const ZBX_FIELD field = {"dns", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBmodify_field_type("interface", &field, NULL);
}
static int DBpatch_3050014(void)
{
const ZBX_FIELD field = {"dns", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBmodify_field_type("proxy_dhistory", &field, NULL);
}
static int DBpatch_3050015(void)
{
const ZBX_FIELD field = {"listen_dns", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBmodify_field_type("autoreg_host", &field, NULL);
}
static int DBpatch_3050016(void)
{
const ZBX_FIELD field = {"listen_dns", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBmodify_field_type("proxy_autoreg_host", &field, NULL);
}
static int DBpatch_3050017(void)
{
const ZBX_FIELD field = {"dns", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBmodify_field_type("dservices", &field, NULL);
}
static int DBpatch_3050018(void)
{
return DBdrop_table("graph_theme");
}
static int DBpatch_3050019(void)
{
const ZBX_TABLE table =
{"graph_theme", "graphthemeid", 0,
{
{"graphthemeid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"theme", "", NULL, NULL, 64, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{"backgroundcolor", "", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{"graphcolor", "", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{"gridcolor", "", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{"maingridcolor", "", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{"gridbordercolor", "", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{"textcolor", "", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{"highlightcolor", "", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{"leftpercentilecolor", "", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{"rightpercentilecolor", "", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{"nonworktimecolor", "", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{"colorpalette", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{0}
},
NULL
};
return DBcreate_table(&table);
}
static int DBpatch_3050020(void)
{
return DBcreate_index("graph_theme", "graph_theme_1", "theme", 1);
}
#define ZBX_COLORPALETTE_LIGHT "1A7C11,F63100,2774A4,A54F10,FC6EA3,6C59DC,AC8C14,611F27,F230E0,5CCD18,BB2A02," \
"5A2B57,89ABF8,7EC25C,274482,2B5429,8048B4,FD5434,790E1F,87AC4D,E89DF4"
#define ZBX_COLORPALETTE_DARK "199C0D,F63100,2774A4,F7941D,FC6EA3,6C59DC,C7A72D,BA2A5D,F230E0,5CCD18,BB2A02," \
"AC41A5,89ABF8,7EC25C,3165D5,79A277,AA73DE,FD5434,F21C3E,87AC4D,E89DF4"
static int DBpatch_3050021(void)
{
if (0 == (ZBX_PROGRAM_TYPE_SERVER & program_type))
return SUCCEED;
if (ZBX_DB_OK <= DBexecute(
"insert into graph_theme"
" values (1,'blue-theme','FFFFFF','FFFFFF','CCD5D9','ACBBC2','ACBBC2','1F2C33','E33734',"
"'429E47','E33734','EBEBEB','" ZBX_COLORPALETTE_LIGHT "')"))
{
return SUCCEED;
}
return FAIL;
}
static int DBpatch_3050022(void)
{
if (0 == (ZBX_PROGRAM_TYPE_SERVER & program_type))
return SUCCEED;
if (ZBX_DB_OK <= DBexecute(
"insert into graph_theme"
" values (2,'dark-theme','2B2B2B','2B2B2B','454545','4F4F4F','4F4F4F','F2F2F2','E45959',"
"'59DB8F','E45959','333333','" ZBX_COLORPALETTE_DARK "')"))
{
return SUCCEED;
}
return FAIL;
}
static int DBpatch_3050023(void)
{
if (0 == (ZBX_PROGRAM_TYPE_SERVER & program_type))
return SUCCEED;
if (ZBX_DB_OK <= DBexecute(
"insert into graph_theme"
" values (3,'hc-light','FFFFFF','FFFFFF','555555','000000','333333','000000','333333',"
"'000000','000000','EBEBEB','" ZBX_COLORPALETTE_LIGHT "')"))
{
return SUCCEED;
}
return FAIL;
}
static int DBpatch_3050024(void)
{
if (0 == (ZBX_PROGRAM_TYPE_SERVER & program_type))
return SUCCEED;
if (ZBX_DB_OK <= DBexecute(
"insert into graph_theme"
" values (4,'hc-dark','000000','000000','666666','888888','4F4F4F','FFFFFF','FFFFFF',"
"'FFFFFF','FFFFFF','333333','" ZBX_COLORPALETTE_DARK "')"))
{
return SUCCEED;
}
return FAIL;
}
#undef ZBX_COLORPALETTE_LIGHT
#undef ZBX_COLORPALETTE_DARK
static int DBpatch_3050025(void)
{
zbx_db_insert_t db_insert;
int ret;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
zbx_db_insert_prepare(&db_insert, "task", "taskid", "type", "status", "clock", NULL);
zbx_db_insert_add_values(&db_insert, __UINT64_C(0), ZBX_TM_TASK_UPDATE_EVENTNAMES, ZBX_TM_STATUS_NEW,
time(NULL));
zbx_db_insert_autoincrement(&db_insert, "taskid");
ret = zbx_db_insert_execute(&db_insert);
zbx_db_insert_clean(&db_insert);
return ret;
}
static int DBpatch_3050026(void)
{
int res;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
res = DBexecute("update profiles set value_str='name' where idx='web.problem.sort' and value_str='problem'");
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050027(void)
{
const ZBX_FIELD field = {"sendto", "", NULL, NULL, 1024, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBmodify_field_type("media", &field, NULL);
}
static int DBpatch_3050028(void)
{
const ZBX_FIELD field = {"sendto", "", NULL, NULL, 1024, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBmodify_field_type("alerts", &field, NULL);
}
extern int DBpatch_3040006(void);
static int DBpatch_3050029(void)
{
return DBpatch_3040006();
}
static int DBpatch_3050030(void)
{
const ZBX_FIELD field = {"custom_color", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBadd_field("config", &field);
}
static int DBpatch_3050031(void)
{
const ZBX_FIELD field = {"problem_unack_color", "CC0000", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBset_default("config", &field);
}
static int DBpatch_3050032(void)
{
const ZBX_FIELD field = {"problem_ack_color", "CC0000", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBset_default("config", &field);
}
static int DBpatch_3050033(void)
{
const ZBX_FIELD field = {"ok_unack_color", "009900", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBset_default("config", &field);
}
static int DBpatch_3050034(void)
{
const ZBX_FIELD field = {"ok_ack_color", "009900", NULL, NULL, 6, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBset_default("config", &field);
}
static int DBpatch_3050035(void)
{
int res;
res = DBexecute(
"update config"
" set custom_color=1"
" where problem_unack_color<>'DC0000'"
" or problem_ack_color<>'DC0000'"
" or ok_unack_color<>'00AA00'"
" or ok_ack_color<>'00AA00'");
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050036(void)
{
int res;
res = DBexecute(
"update config"
" set problem_unack_color='CC0000',"
"problem_ack_color='CC0000',"
"ok_unack_color='009900',"
"ok_ack_color='009900'"
" where problem_unack_color='DC0000'"
" and problem_ack_color='DC0000'"
" and ok_unack_color='00AA00'"
" and ok_ack_color='00AA00'");
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
extern int DBpatch_3040007(void);
static int DBpatch_3050037(void)
{
return DBpatch_3040007();
}
static int DBpatch_3050038(void)
{
const ZBX_TABLE table =
{"tag_filter", "tag_filterid", 0,
{
{"tag_filterid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"usrgrpid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"groupid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"tag", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{"value", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{0}
},
NULL
};
return DBcreate_table(&table);
}
static int DBpatch_3050039(void)
{
const ZBX_FIELD field = {"usrgrpid", NULL, "usrgrp", "usrgrpid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
return DBadd_foreign_key("tag_filter", 1, &field);
}
static int DBpatch_3050040(void)
{
const ZBX_FIELD field = {"groupid", NULL, "groups", "groupid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
return DBadd_foreign_key("tag_filter", 2, &field);
}
static int DBpatch_3050041(void)
{
const ZBX_TABLE table =
{"task_check_now", "taskid", 0,
{
{"taskid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"itemid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{0}
},
NULL
};
return DBcreate_table(&table);
}
static int DBpatch_3050042(void)
{
const ZBX_FIELD field = {"taskid", NULL, "task", "taskid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
return DBadd_foreign_key("task_check_now", 1, &field);
}
static int DBpatch_3050043(void)
{
const char *sql =
"update widget_field"
" set value_int=3"
" where name='show_tags'"
" and exists ("
"select null"
" from widget w"
" where widget_field.widgetid=w.widgetid"
" and w.type='problems'"
")";
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
if (ZBX_DB_OK <= DBexecute("%s", sql))
return SUCCEED;
return FAIL;
}
static int DBpatch_3050044(void)
{
const char *sql =
"delete from profiles"
" where idx in ('web.paging.lastpage','web.menu.view.last') and value_str='tr_status.php'"
" or idx like 'web.tr_status%'";
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
if (ZBX_DB_OK <= DBexecute("%s", sql))
return SUCCEED;
return FAIL;
}
static int DBpatch_3050045(void)
{
const char *sql = "update users set url='zabbix.php?action=problem.view' where url like '%tr_status.php%'";
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
if (ZBX_DB_OK <= DBexecute("%s", sql))
return SUCCEED;
return FAIL;
}
static int DBpatch_3050046(void)
{
const ZBX_FIELD field = {"timeout", "3s", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050047(void)
{
const ZBX_FIELD field = {"url", "", NULL, NULL, 2048, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050048(void)
{
const ZBX_FIELD field = {"query_fields", "", NULL, NULL, 2048, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050049(void)
{
const ZBX_FIELD field = {"posts", "", NULL, NULL, 0, ZBX_TYPE_SHORTTEXT, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050050(void)
{
const ZBX_FIELD field = {"status_codes", "200", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050051(void)
{
const ZBX_FIELD field = {"follow_redirects", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050052(void)
{
const ZBX_FIELD field = {"post_type", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050053(void)
{
const ZBX_FIELD field = {"http_proxy", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050054(void)
{
const ZBX_FIELD field = {"headers", "", NULL, NULL, 0, ZBX_TYPE_SHORTTEXT, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050055(void)
{
const ZBX_FIELD field = {"retrieve_mode", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050056(void)
{
const ZBX_FIELD field = {"request_method", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050057(void)
{
const ZBX_FIELD field = {"output_format", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050058(void)
{
const ZBX_FIELD field = {"ssl_cert_file", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050059(void)
{
const ZBX_FIELD field = {"ssl_key_file", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050060(void)
{
const ZBX_FIELD field = {"ssl_key_password", "", NULL, NULL, 64, ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050061(void)
{
const ZBX_FIELD field = {"verify_peer", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050062(void)
{
const ZBX_FIELD field = {"verify_host", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050063(void)
{
const ZBX_FIELD field = {"allow_traps", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL | ZBX_PROXY, 0};
return DBadd_field("items", &field);
}
static int DBpatch_3050064(void)
{
const ZBX_FIELD field = {"auto_compress", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBadd_field("hosts", &field);
}
static int DBpatch_3050065(void)
{
int ret;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
/* 5 - HOST_STATUS_PROXY_ACTIVE, 6 - HOST_STATUS_PROXY_PASSIVE */
ret = DBexecute("update hosts set auto_compress=0 where status=5 or status=6");
if (ZBX_DB_OK > ret)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050066(void)
{
int i;
const char *types[] = {
"actlog", "actionlog",
"dscvry", "discovery",
"favgrph", "favgraphs",
"favmap", "favmaps",
"favscr", "favscreens",
"hoststat", "problemhosts",
"navigationtree", "navtree",
"stszbx", "systeminfo",
"sysmap", "map",
"syssum", "problemsbysv",
"webovr", "web",
NULL
};
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
for (i = 0; NULL != types[i]; i += 2)
{
if (ZBX_DB_OK > DBexecute("update widget set type='%s' where type='%s'", types[i + 1], types[i]))
return FAIL;
}
return SUCCEED;
}
static int DBpatch_3050067(void)
{
return DBdrop_field("config", "event_expire");
}
static int DBpatch_3050068(void)
{
return DBdrop_field("config", "event_show_max");
}
static int DBpatch_3050069(void)
{
int res;
res = DBexecute(
"update widget_field"
" set name='itemids'"
" where name='itemid'"
" and exists ("
"select null"
" from widget w"
" where widget_field.widgetid=w.widgetid"
" and w.type='plaintext'"
")");
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
/* remove references to table that is about to be renamed, this is required on IBM DB2 */
static int DBpatch_3050070(void)
{
#ifdef HAVE_IBM_DB2
return DBdrop_foreign_key("group_prototype", 2);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050071(void)
{
#ifdef HAVE_IBM_DB2
return DBdrop_foreign_key("group_discovery", 1);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050072(void)
{
#ifdef HAVE_IBM_DB2
return DBdrop_foreign_key("scripts", 2);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050073(void)
{
#ifdef HAVE_IBM_DB2
return DBdrop_foreign_key("opcommand_grp", 2);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050074(void)
{
#ifdef HAVE_IBM_DB2
return DBdrop_foreign_key("opgroup", 2);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050075(void)
{
#ifdef HAVE_IBM_DB2
return DBdrop_foreign_key("config", 2);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050076(void)
{
#ifdef HAVE_IBM_DB2
return DBdrop_foreign_key("hosts_groups", 2);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050077(void)
{
#ifdef HAVE_IBM_DB2
return DBdrop_foreign_key("rights", 2);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050078(void)
{
#ifdef HAVE_IBM_DB2
return DBdrop_foreign_key("maintenances_groups", 2);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050079(void)
{
#ifdef HAVE_IBM_DB2
return DBdrop_foreign_key("tag_filter", 2);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050080(void)
{
#ifdef HAVE_IBM_DB2
return DBdrop_foreign_key("corr_condition_group", 2);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050081(void)
{
#ifdef HAVE_IBM_DB2
return DBdrop_foreign_key("widget_field", 2);
#else
return SUCCEED;
#endif
}
/* groups is reserved keyword since MySQL 8.0 */
static int DBpatch_3050082(void)
{
return DBrename_table("groups", "hstgrp");
}
static int DBpatch_3050083(void)
{
return DBrename_index("hstgrp", "groups_1", "hstgrp_1", "name", 0);
}
/* restore references after renaming table on IBM DB2 */
static int DBpatch_3050084(void)
{
#ifdef HAVE_IBM_DB2
const ZBX_FIELD field = {"groupid", NULL, "hstgrp", "groupid", 0, 0, 0, 0};
return DBadd_foreign_key("group_prototype", 2, &field);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050085(void)
{
#ifdef HAVE_IBM_DB2
const ZBX_FIELD field = {"groupid", NULL, "hstgrp", "groupid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
return DBadd_foreign_key("group_discovery", 1, &field);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050086(void)
{
#ifdef HAVE_IBM_DB2
const ZBX_FIELD field = {"groupid", NULL, "hstgrp", "groupid", 0, 0, 0, 0};
return DBadd_foreign_key("scripts", 2, &field);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050087(void)
{
#ifdef HAVE_IBM_DB2
const ZBX_FIELD field = {"groupid", NULL, "hstgrp", "groupid", 0, 0, 0, 0};
return DBadd_foreign_key("opcommand_grp", 2, &field);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050088(void)
{
#ifdef HAVE_IBM_DB2
const ZBX_FIELD field = {"groupid", NULL, "hstgrp", "groupid", 0, 0, 0, 0};
return DBadd_foreign_key("opgroup", 2, &field);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050089(void)
{
#ifdef HAVE_IBM_DB2
const ZBX_FIELD field = {"discovery_groupid", NULL, "hstgrp", "groupid", 0, 0, 0, 0};
return DBadd_foreign_key("config", 2, &field);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050090(void)
{
#ifdef HAVE_IBM_DB2
const ZBX_FIELD field = {"groupid", NULL, "hstgrp", "groupid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
return DBadd_foreign_key("hosts_groups", 2, &field);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050091(void)
{
#ifdef HAVE_IBM_DB2
const ZBX_FIELD field = {"id", NULL, "hstgrp", "groupid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
return DBadd_foreign_key("rights", 2, &field);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050092(void)
{
#ifdef HAVE_IBM_DB2
const ZBX_FIELD field = {"groupid", NULL, "hstgrp", "groupid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
return DBadd_foreign_key("maintenances_groups", 2, &field);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050093(void)
{
#ifdef HAVE_IBM_DB2
const ZBX_FIELD field = {"groupid", NULL, "hstgrp", "groupid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
return DBadd_foreign_key("tag_filter", 2, &field);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050094(void)
{
#ifdef HAVE_IBM_DB2
const ZBX_FIELD field = {"groupid", NULL, "hstgrp", "groupid", 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0};
return DBadd_foreign_key("corr_condition_group", 2, &field);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050095(void)
{
#ifdef HAVE_IBM_DB2
const ZBX_FIELD field = {"value_groupid", NULL, "hstgrp", "groupid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
return DBadd_foreign_key("widget_field", 2, &field);
#else
return SUCCEED;
#endif
}
/* function is reserved keyword since MySQL 8.0 */
static int DBpatch_3050096(void)
{
#ifdef HAVE_IBM_DB2
return DBdrop_foreign_key("functions", 1);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050097(void)
{
#ifdef HAVE_IBM_DB2
return DBdrop_index("functions", "functions_2");
#else
return SUCCEED;
#endif
}
static int DBpatch_3050098(void)
{
const ZBX_FIELD field = {"name", "", NULL, NULL, 12, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBrename_field("functions", "function", &field);
}
static int DBpatch_3050099(void)
{
#ifdef HAVE_IBM_DB2
return DBcreate_index("functions", "functions_2", "itemid,name,parameter", 0);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050100(void)
{
#ifdef HAVE_IBM_DB2
const ZBX_FIELD field = {"itemid", NULL, "items", "itemid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
return DBadd_foreign_key("functions", 1, &field);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050101(void)
{
#ifdef HAVE_POSTGRESQL
if (FAIL == DBindex_exists("hstgrp", "groups_pkey"))
return SUCCEED;
return DBrename_index("hstgrp", "groups_pkey", "hstgrp_pkey", "groupid", 0);
#else
return SUCCEED;
#endif
}
static int DBpatch_3050102(void)
{
DB_RESULT result;
DB_ROW row;
int ret = SUCCEED;
zbx_vector_uint64_t ids;
zbx_vector_uint64_create(&ids);
result = DBselect(
"select a.autoreg_hostid,a.proxy_hostid,h.proxy_hostid"
" from autoreg_host a"
" left join hosts h"
" on h.host=a.host");
while (NULL != (row = DBfetch(result)))
{
zbx_uint64_t autoreg_proxy_hostid, host_proxy_hostid;
ZBX_DBROW2UINT64(autoreg_proxy_hostid, row[1]);
ZBX_DBROW2UINT64(host_proxy_hostid, row[2]);
if (autoreg_proxy_hostid != host_proxy_hostid)
{
zbx_uint64_t id;
ZBX_STR2UINT64(id, row[0]);
zbx_vector_uint64_append(&ids, id);
}
}
DBfree_result(result);
if (0 != ids.values_num)
{
char *sql = NULL;
size_t sql_alloc = 0, sql_offset = 0;
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, "delete from autoreg_host where");
DBadd_condition_alloc(&sql, &sql_alloc, &sql_offset, "autoreg_hostid", ids.values, ids.values_num);
if (ZBX_DB_OK > DBexecute("%s", sql))
ret = FAIL;
zbx_free(sql);
}
zbx_vector_uint64_destroy(&ids);
return ret;
}
static int DBpatch_3050103(void)
{
return DBcreate_index("autoreg_host", "autoreg_host_2", "proxy_hostid", 0);
}
static int DBpatch_3050104(void)
{
return DBdrop_index("autoreg_host", "autoreg_host_1");
}
static int DBpatch_3050105(void)
{
return DBcreate_index("autoreg_host", "autoreg_host_1", "host", 0);
}
static int DBpatch_3050106(void)
{
int res;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
res = DBexecute("update profiles set value_int=2 where idx='web.problem.filter.evaltype' and value_int=1");
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050107(void)
{
int res;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
res = DBexecute(
"update widget_field"
" set value_int=2"
" where name='evaltype'"
" and value_int=1"
" and exists ("
"select null"
" from widget w"
" where widget_field.widgetid=w.widgetid"
" and w.type='problems'"
")");
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050108(void)
{
int res;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
res = DBexecute(
"delete from profiles"
" where idx like '%%.filter.state'"
" or idx like '%%.timelinefixed'"
" or idx like '%%.period'"
" or idx like '%%.stime'"
" or idx like '%%.isnow'"
);
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050109(void)
{
const ZBX_FIELD field = {"ok_period", "5m", NULL, NULL, 32, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBset_default("config", &field);
}
static int DBpatch_3050110(void)
{
const ZBX_FIELD field = {"blink_period", "2m", NULL, NULL, 32, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBset_default("config", &field);
}
static int DBpatch_3050111(void)
{
const ZBX_FIELD field = {"severity", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBadd_field("events", &field);
}
static int DBpatch_3050112(void)
{
const ZBX_FIELD field = {"acknowledged", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBadd_field("problem", &field);
}
static int DBpatch_3050113(void)
{
const ZBX_FIELD field = {"severity", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBadd_field("problem", &field);
}
static int DBpatch_3050114(void)
{
const ZBX_FIELD field = {"old_severity", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBadd_field("acknowledges", &field);
}
static int DBpatch_3050115(void)
{
const ZBX_FIELD field = {"new_severity", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBadd_field("acknowledges", &field);
}
static int DBpatch_3050116(void)
{
return DBdrop_field("config", "event_ack_enable");
}
static int DBpatch_3050117(void)
{
int ret;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
ret = DBexecute("update problem set acknowledged="
"(select acknowledged from events where events.eventid=problem.eventid)");
if (ZBX_DB_OK > ret)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050118(void)
{
DB_ROW row;
DB_RESULT result;
int ret = SUCCEED;
char *sql = NULL;
size_t sql_alloc = 0, sql_offset = 0;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
result = DBselect(
"select e.eventid,t.priority"
" from events e"
" inner join triggers t"
" on e.objectid=t.triggerid"
" where e.source=0"
" and e.object=0"
" and e.value=1"
);
while (NULL != (row = DBfetch(result)))
{
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, "update events set severity=%s where eventid=%s;\n",
row[1], row[0]);
if (SUCCEED != (ret = DBexecute_overflowed_sql(&sql, &sql_alloc, &sql_offset)))
goto out;
}
DBend_multiple_update(&sql, &sql_alloc, &sql_offset);
if (16 < sql_offset && ZBX_DB_OK > DBexecute("%s", sql))
ret = FAIL;
out:
DBfree_result(result);
zbx_free(sql);
return ret;
}
static int DBpatch_3050119(void)
{
DB_ROW row;
DB_RESULT result;
int ret = SUCCEED;
char *sql = NULL;
size_t sql_alloc = 0, sql_offset = 0;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
result = DBselect(
"select p.eventid,t.priority"
" from problem p"
" inner join triggers t"
" on p.objectid=t.triggerid"
" where p.source=0"
" and p.object=0"
);
while (NULL != (row = DBfetch(result)))
{
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, "update problem set severity=%s where eventid=%s;\n",
row[1], row[0]);
if (SUCCEED != (ret = DBexecute_overflowed_sql(&sql, &sql_alloc, &sql_offset)))
goto out;
}
DBend_multiple_update(&sql, &sql_alloc, &sql_offset);
if (16 < sql_offset && ZBX_DB_OK > DBexecute("%s", sql))
ret = FAIL;
out:
DBfree_result(result);
zbx_free(sql);
return ret;
}
static int DBpatch_3050120(void)
{
int ret = SUCCEED, action;
zbx_uint64_t ackid, eventid;
zbx_hashset_t eventids;
DB_RESULT result;
DB_ROW row;
char *sql;
size_t sql_alloc = 4096, sql_offset = 0;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
sql = zbx_malloc(NULL, sql_alloc);
zbx_hashset_create(&eventids, 1000, ZBX_DEFAULT_UINT64_HASH_FUNC, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
result = DBselect("select acknowledgeid,eventid,action from acknowledges order by clock");
while (NULL != (row = DBfetch(result)))
{
ZBX_STR2UINT64(ackid, row[0]);
ZBX_STR2UINT64(eventid, row[1]);
action = atoi(row[2]);
/* 0x04 - ZBX_ACKNOWLEDGE_ACTION_COMMENT */
action |= 0x04;
if (NULL == zbx_hashset_search(&eventids, &eventid))
{
zbx_hashset_insert(&eventids, &eventid, sizeof(eventid));
/* 0x02 - ZBX_ACKNOWLEDGE_ACTION_ACKNOWLEDGE */
action |= 0x02;
}
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
"update acknowledges set action=%d where acknowledgeid=" ZBX_FS_UI64 ";\n",
action, ackid);
if (SUCCEED != (ret = DBexecute_overflowed_sql(&sql, &sql_alloc, &sql_offset)))
goto out;
}
DBend_multiple_update(&sql, &sql_alloc, &sql_offset);
if (16 < sql_offset && ZBX_DB_OK > DBexecute("%s", sql))
ret = FAIL;
out:
zbx_hashset_destroy(&eventids);
DBfree_result(result);
zbx_free(sql);
return ret;
}
static int DBpatch_3050121(void)
{
int res;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
res = DBexecute(
"update profiles set value_str='severity' where idx='web.problem.sort' and value_str='priority'");
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static void DBpatch_3050122_add_anchors(const char *src, char *dst, size_t src_len)
{
*dst++ = '^'; /* start anchor */
if (0 != src_len)
{
memcpy(dst, src, src_len); /* parameter body */
dst += src_len;
}
*dst++ = '$'; /* end anchor */
*dst = '\0';
}
static int DBpatch_3050122(void)
{
DB_ROW row;
DB_RESULT result;
int ret = FAIL;
char *sql = NULL;
size_t sql_alloc = 0, sql_offset = 0;
DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
result = DBselect("select functionid,parameter from functions where name='logsource'");
while (NULL != (row = DBfetch(result)))
{
const char *orig_param = row[1];
char *processed_parameter = NULL, *unquoted_parameter, *parameter_anchored = NULL,
*db_parameter_esc;
size_t param_pos, param_len, sep_pos, param_alloc = 0, param_offset = 0, current_len;
int was_quoted;
zbx_function_param_parse(orig_param, ¶m_pos, ¶m_len, &sep_pos);
/* copy leading whitespace (if any) or empty string */
zbx_strncpy_alloc(&processed_parameter, ¶m_alloc, ¶m_offset, orig_param, param_pos);
unquoted_parameter = zbx_function_param_unquote_dyn(orig_param + param_pos, param_len, &was_quoted);
zbx_regexp_escape(&unquoted_parameter);
current_len = strlen(unquoted_parameter);
/* increasing length by 3 for ^, $, '\0' */
parameter_anchored = (char *)zbx_malloc(NULL, current_len + 3);
DBpatch_3050122_add_anchors(unquoted_parameter, parameter_anchored, current_len);
zbx_free(unquoted_parameter);
if (SUCCEED != zbx_function_param_quote(¶meter_anchored, was_quoted))
{
zabbix_log(LOG_LEVEL_WARNING, "Cannot convert parameter \"%s\" of trigger function"
" logsource (functionid: %s) to regexp during database upgrade. The"
" parameter needs to but cannot be quoted after conversion.",
row[1], row[0]);
zbx_free(parameter_anchored);
zbx_free(processed_parameter);
continue;
}
/* copy the parameter */
zbx_strcpy_alloc(&processed_parameter, ¶m_alloc, ¶m_offset, parameter_anchored);
zbx_free(parameter_anchored);
/* copy trailing whitespace (if any) or empty string */
zbx_strncpy_alloc(&processed_parameter, ¶m_alloc, ¶m_offset, orig_param + param_pos + param_len,
sep_pos - param_pos - param_len + 1);
if (FUNCTION_PARAM_LEN < (current_len = zbx_strlen_utf8(processed_parameter)))
{
zabbix_log(LOG_LEVEL_WARNING, "Cannot convert parameter \"%s\" of trigger function logsource"
" (functionid: %s) to regexp during database upgrade. The converted"
" value is too long for field \"parameter\" - " ZBX_FS_SIZE_T " characters."
" Allowed length is %d characters.",
row[1], row[0], (zbx_fs_size_t)current_len, FUNCTION_PARAM_LEN);
zbx_free(processed_parameter);
continue;
}
db_parameter_esc = DBdyn_escape_string_len(processed_parameter, FUNCTION_PARAM_LEN);
zbx_free(processed_parameter);
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset,
"update functions set parameter='%s' where functionid=%s;\n",
db_parameter_esc, row[0]);
zbx_free(db_parameter_esc);
if (SUCCEED != DBexecute_overflowed_sql(&sql, &sql_alloc, &sql_offset))
goto out;
}
DBend_multiple_update(&sql, &sql_alloc, &sql_offset);
if (16 < sql_offset)
{
if (ZBX_DB_OK > DBexecute("%s", sql))
goto out;
}
ret = SUCCEED;
out:
DBfree_result(result);
zbx_free(sql);
return ret;
}
static int DBpatch_3050123(void)
{
int res;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
res = DBexecute(
"delete from profiles where idx in ("
"'web.toptriggers.filter.from','web.toptriggers.filter.till','web.avail_report.0.timesince',"
"'web.avail_report.0.timetill','web.avail_report.1.timesince','web.avail_report.1.timetill'"
")");
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050124(void)
{
const ZBX_FIELD field = {"request_method", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBset_default("items", &field);
}
static int DBpatch_3050125(void)
{
return DBcreate_index("problem_tag", "problem_tag_3", "eventid,tag,value", 0);
}
static int DBpatch_3050126(void)
{
return DBdrop_index("problem_tag", "problem_tag_1");
}
static int DBpatch_3050127(void)
{
return DBdrop_index("problem_tag", "problem_tag_2");
}
static int DBpatch_3050128(void)
{
return DBrename_index("problem_tag", "problem_tag_3", "problem_tag_1", "eventid,tag,value", 0);
}
static int DBpatch_3050129(void)
{
const ZBX_TABLE table =
{"event_suppress", "event_suppressid", 0,
{
{"event_suppressid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"eventid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"maintenanceid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, 0, 0},
{"suppress_until", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
{0}
},
NULL
};
return DBcreate_table(&table);
}
static int DBpatch_3050130(void)
{
return DBcreate_index("event_suppress", "event_suppress_1", "eventid,maintenanceid", 1);
}
static int DBpatch_3050131(void)
{
return DBcreate_index("event_suppress", "event_suppress_2", "suppress_until", 0);
}
static int DBpatch_3050132(void)
{
return DBcreate_index("event_suppress", "event_suppress_3", "maintenanceid", 0);
}
static int DBpatch_3050133(void)
{
const ZBX_FIELD field = {"eventid", NULL, "events", "eventid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
return DBadd_foreign_key("event_suppress", 1, &field);
}
static int DBpatch_3050134(void)
{
const ZBX_FIELD field = {"maintenanceid", NULL, "maintenances", "maintenanceid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
return DBadd_foreign_key("event_suppress", 2, &field);
}
static int DBpatch_3050135(void)
{
const ZBX_TABLE table =
{"maintenance_tag", "maintenancetagid", 0,
{
{"maintenancetagid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"maintenanceid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"tag", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{"operator", "2", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
{"value", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{0}
},
NULL
};
return DBcreate_table(&table);
}
static int DBpatch_3050136(void)
{
return DBcreate_index("maintenance_tag", "maintenance_tag_1", "maintenanceid", 0);
}
static int DBpatch_3050137(void)
{
const ZBX_FIELD field = {"maintenanceid", NULL, "maintenances", "maintenanceid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
return DBadd_foreign_key("maintenance_tag", 1, &field);
}
static int DBpatch_3050138(void)
{
const ZBX_FIELD field = {"show_suppressed", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBadd_field("sysmaps", &field);
}
static int DBpatch_3050139(void)
{
const ZBX_FIELD field = {"tags_evaltype", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBadd_field("maintenances", &field);
}
static int DBpatch_3050140(void)
{
const ZBX_FIELD field = {"pause_suppressed", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBrename_field("actions", "maintenance_mode", &field);
}
static int DBpatch_3050141(void)
{
int ret;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
ret = DBexecute("update profiles"
" set idx='web.problem.filter.show_suppressed'"
" where idx='web.problem.filter.maintenance'");
if (ZBX_DB_OK > ret)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050142(void)
{
int ret;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
ret = DBexecute("update profiles"
" set idx='web.overview.filter.show_suppressed'"
" where idx='web.overview.filter.show_maintenance'");
if (ZBX_DB_OK > ret)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050143(void)
{
int ret;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
ret = DBexecute("update widget_field"
" set name='show_suppressed'"
" where name='maintenance'"
" and exists (select null"
" from widget"
" where widget.widgetid=widget_field.widgetid"
" and widget.type in ('problems','problemhosts','problemsbysv'))");
if (ZBX_DB_OK > ret)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050144(void)
{
DB_RESULT result;
DB_ROW row;
int ret = FAIL;
zbx_db_insert_t db_insert;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
zbx_db_insert_prepare(&db_insert, "widget_field", "widget_fieldid", "widgetid", "type", "name", "value_int",
NULL);
/* type : 'problem' - WIDGET_PROBLEMS */
result = DBselect("select w.widgetid"
" from widget w"
" where w.type in ('problems','problemhosts','problemsbysv')"
" and not exists (select null"
" from widget_field wf"
" where w.widgetid=wf.widgetid"
" and wf.name='show_suppressed')");
while (NULL != (row = DBfetch(result)))
{
zbx_uint64_t widgetid;
ZBX_STR2UINT64(widgetid, row[0]);
zbx_db_insert_add_values(&db_insert, __UINT64_C(0), widgetid, 0, "show_suppressed", 1);
}
DBfree_result(result);
zbx_db_insert_autoincrement(&db_insert, "widget_fieldid");
ret = zbx_db_insert_execute(&db_insert);
zbx_db_insert_clean(&db_insert);
return ret;
}
static int DBpatch_3050145(void)
{
int ret;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
/* CONDITION_OPERATOR_IN (4) -> CONDITION_OPERATOR_YES (10) */
/* for conditiontype CONDITION_TYPE_SUPPRESSED (16) */
ret = DBexecute("update conditions"
" set operator=10"
" where conditiontype=16"
" and operator=4");
if (ZBX_DB_OK > ret)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050146(void)
{
int ret;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
/* CONDITION_OPERATOR_NOT_IN (7) -> CONDITION_OPERATOR_NO (11) */
/* for conditiontype CONDITION_TYPE_SUPPRESSED (16) */
ret = DBexecute("update conditions"
" set operator=11"
" where conditiontype=16"
" and operator=7");
if (ZBX_DB_OK > ret)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050147(void)
{
const ZBX_FIELD field = {"http_auth_enabled", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBadd_field("config", &field);
}
static int DBpatch_3050148(void)
{
const ZBX_FIELD field = {"http_login_form", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBadd_field("config", &field);
}
static int DBpatch_3050149(void)
{
const ZBX_FIELD field = {"http_strip_domains", "", NULL, NULL, 2048, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBadd_field("config", &field);
}
static int DBpatch_3050150(void)
{
const ZBX_FIELD field = {"http_case_sensitive", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBadd_field("config", &field);
}
static int DBpatch_3050151(void)
{
const ZBX_FIELD field = {"ldap_configured", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBadd_field("config", &field);
}
static int DBpatch_3050152(void)
{
const ZBX_FIELD field = {"ldap_case_sensitive", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBadd_field("config", &field);
}
static int DBpatch_3050153(void)
{
int res;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
/* Change ZBX_AUTH_HTTP to ZBX_AUTH_INTERNAL and enable HTTP_AUTH option. */
res = DBexecute("update config set authentication_type=0,http_auth_enabled=1 where authentication_type=2");
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050154(void)
{
int res;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
/* New GUI access type is added GROUP_GUI_ACCESS_LDAP, update value of GROUP_GUI_ACCESS_DISABLED. */
/* 2 - old value of GROUP_GUI_ACCESS_DISABLED */
/* 3 - new value of GROUP_GUI_ACCESS_DISABLED */
res = DBexecute("update usrgrp set gui_access=3 where gui_access=2");
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050155(void)
{
int res;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
/* Update ldap_configured to ZBX_AUTH_LDAP_ENABLED for config with default authentication type ZBX_AUTH_LDAP. */
/* Update ldap_case_sensitive to ZBX_AUTH_CASE_SENSITIVE. */
res = DBexecute("update config set ldap_configured=1,ldap_case_sensitive=1 where authentication_type=1");
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050156(void)
{
int res;
if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
res = DBexecute(
"delete from widget_field"
" where (name like 'ds.order.%%' or name like 'or.order.%%')"
" and exists ("
"select null"
" from widget w"
" where widget_field.widgetid=w.widgetid"
" and w.type='svggraph'"
")");
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050157(void)
{
const ZBX_FIELD field = {"passwd", "", NULL, NULL, 32, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBmodify_field_type("users", &field, NULL);
}
static int DBpatch_3050158(void)
{
int res;
res = DBexecute("update users set passwd=rtrim(passwd)");
if (ZBX_DB_OK > res)
return FAIL;
return SUCCEED;
}
static int DBpatch_3050159(void)
{
return DBcreate_index("escalations", "escalations_2", "eventid", 0);
}
static int DBpatch_3050160(void)
{
return DBdrop_index("escalations", "escalations_1");
}
static int DBpatch_3050161(void)
{
return DBcreate_index("escalations", "escalations_1", "triggerid,itemid,escalationid", 1);
}
static int DBpatch_3050162(void)
{
return DBcreate_index("escalations", "escalations_3", "nextcheck", 0);
}
#endif
DBPATCH_START(3050)
/* version, duplicates flag, mandatory flag */
DBPATCH_ADD(3050000, 0, 1)
DBPATCH_ADD(3050001, 0, 1)
DBPATCH_ADD(3050004, 0, 1)
DBPATCH_ADD(3050005, 0, 1)
DBPATCH_ADD(3050008, 0, 1)
DBPATCH_ADD(3050009, 0, 1)
DBPATCH_ADD(3050010, 0, 1)
DBPATCH_ADD(3050011, 0, 1)
DBPATCH_ADD(3050012, 0, 1)
DBPATCH_ADD(3050013, 0, 1)
DBPATCH_ADD(3050014, 0, 1)
DBPATCH_ADD(3050015, 0, 1)
DBPATCH_ADD(3050016, 0, 1)
DBPATCH_ADD(3050017, 0, 1)
DBPATCH_ADD(3050018, 0, 1)
DBPATCH_ADD(3050019, 0, 1)
DBPATCH_ADD(3050020, 0, 1)
DBPATCH_ADD(3050021, 0, 1)
DBPATCH_ADD(3050022, 0, 1)
DBPATCH_ADD(3050023, 0, 1)
DBPATCH_ADD(3050024, 0, 1)
DBPATCH_ADD(3050025, 0, 1)
DBPATCH_ADD(3050026, 0, 1)
DBPATCH_ADD(3050027, 0, 1)
DBPATCH_ADD(3050028, 0, 1)
DBPATCH_ADD(3050029, 0, 0)
DBPATCH_ADD(3050030, 0, 1)
DBPATCH_ADD(3050031, 0, 1)
DBPATCH_ADD(3050032, 0, 1)
DBPATCH_ADD(3050033, 0, 1)
DBPATCH_ADD(3050034, 0, 1)
DBPATCH_ADD(3050035, 0, 1)
DBPATCH_ADD(3050036, 0, 1)
DBPATCH_ADD(3050037, 0, 1)
DBPATCH_ADD(3050038, 0, 1)
DBPATCH_ADD(3050039, 0, 1)
DBPATCH_ADD(3050040, 0, 1)
DBPATCH_ADD(3050041, 0, 1)
DBPATCH_ADD(3050042, 0, 1)
DBPATCH_ADD(3050043, 0, 1)
DBPATCH_ADD(3050044, 0, 1)
DBPATCH_ADD(3050045, 0, 1)
DBPATCH_ADD(3050046, 0, 1)
DBPATCH_ADD(3050047, 0, 1)
DBPATCH_ADD(3050048, 0, 1)
DBPATCH_ADD(3050049, 0, 1)
DBPATCH_ADD(3050050, 0, 1)
DBPATCH_ADD(3050051, 0, 1)
DBPATCH_ADD(3050052, 0, 1)
DBPATCH_ADD(3050053, 0, 1)
DBPATCH_ADD(3050054, 0, 1)
DBPATCH_ADD(3050055, 0, 1)
DBPATCH_ADD(3050056, 0, 1)
DBPATCH_ADD(3050057, 0, 1)
DBPATCH_ADD(3050058, 0, 1)
DBPATCH_ADD(3050059, 0, 1)
DBPATCH_ADD(3050060, 0, 1)
DBPATCH_ADD(3050061, 0, 1)
DBPATCH_ADD(3050062, 0, 1)
DBPATCH_ADD(3050063, 0, 1)
DBPATCH_ADD(3050064, 0, 1)
DBPATCH_ADD(3050065, 0, 1)
DBPATCH_ADD(3050066, 0, 1)
DBPATCH_ADD(3050067, 0, 1)
DBPATCH_ADD(3050068, 0, 1)
DBPATCH_ADD(3050069, 0, 1)
DBPATCH_ADD(3050070, 0, 1)
DBPATCH_ADD(3050071, 0, 1)
DBPATCH_ADD(3050072, 0, 1)
DBPATCH_ADD(3050073, 0, 1)
DBPATCH_ADD(3050074, 0, 1)
DBPATCH_ADD(3050075, 0, 1)
DBPATCH_ADD(3050076, 0, 1)
DBPATCH_ADD(3050077, 0, 1)
DBPATCH_ADD(3050078, 0, 1)
DBPATCH_ADD(3050079, 0, 1)
DBPATCH_ADD(3050080, 0, 1)
DBPATCH_ADD(3050081, 0, 1)
DBPATCH_ADD(3050082, 0, 1)
DBPATCH_ADD(3050083, 0, 1)
DBPATCH_ADD(3050084, 0, 1)
DBPATCH_ADD(3050085, 0, 1)
DBPATCH_ADD(3050086, 0, 1)
DBPATCH_ADD(3050087, 0, 1)
DBPATCH_ADD(3050088, 0, 1)
DBPATCH_ADD(3050089, 0, 1)
DBPATCH_ADD(3050090, 0, 1)
DBPATCH_ADD(3050091, 0, 1)
DBPATCH_ADD(3050092, 0, 1)
DBPATCH_ADD(3050093, 0, 1)
DBPATCH_ADD(3050094, 0, 1)
DBPATCH_ADD(3050095, 0, 1)
DBPATCH_ADD(3050096, 0, 1)
DBPATCH_ADD(3050097, 0, 1)
DBPATCH_ADD(3050098, 0, 1)
DBPATCH_ADD(3050099, 0, 1)
DBPATCH_ADD(3050100, 0, 1)
DBPATCH_ADD(3050101, 0, 1)
DBPATCH_ADD(3050102, 0, 1)
DBPATCH_ADD(3050103, 0, 1)
DBPATCH_ADD(3050104, 0, 1)
DBPATCH_ADD(3050105, 0, 1)
DBPATCH_ADD(3050106, 0, 1)
DBPATCH_ADD(3050107, 0, 1)
DBPATCH_ADD(3050108, 0, 1)
DBPATCH_ADD(3050109, 0, 1)
DBPATCH_ADD(3050110, 0, 1)
DBPATCH_ADD(3050111, 0, 1)
DBPATCH_ADD(3050112, 0, 1)
DBPATCH_ADD(3050113, 0, 1)
DBPATCH_ADD(3050114, 0, 1)
DBPATCH_ADD(3050115, 0, 1)
DBPATCH_ADD(3050116, 0, 1)
DBPATCH_ADD(3050117, 0, 1)
DBPATCH_ADD(3050118, 0, 1)
DBPATCH_ADD(3050119, 0, 1)
DBPATCH_ADD(3050120, 0, 1)
DBPATCH_ADD(3050121, 0, 1)
DBPATCH_ADD(3050122, 0, 1)
DBPATCH_ADD(3050123, 0, 1)
DBPATCH_ADD(3050124, 0, 1)
DBPATCH_ADD(3050125, 0, 1)
DBPATCH_ADD(3050126, 0, 1)
DBPATCH_ADD(3050127, 0, 1)
DBPATCH_ADD(3050128, 0, 1)
DBPATCH_ADD(3050129, 0, 1)
DBPATCH_ADD(3050130, 0, 1)
DBPATCH_ADD(3050131, 0, 1)
DBPATCH_ADD(3050132, 0, 1)
DBPATCH_ADD(3050133, 0, 1)
DBPATCH_ADD(3050134, 0, 1)
DBPATCH_ADD(3050135, 0, 1)
DBPATCH_ADD(3050136, 0, 1)
DBPATCH_ADD(3050137, 0, 1)
DBPATCH_ADD(3050138, 0, 1)
DBPATCH_ADD(3050139, 0, 1)
DBPATCH_ADD(3050140, 0, 1)
DBPATCH_ADD(3050141, 0, 1)
DBPATCH_ADD(3050142, 0, 1)
DBPATCH_ADD(3050143, 0, 1)
DBPATCH_ADD(3050144, 0, 1)
DBPATCH_ADD(3050145, 0, 1)
DBPATCH_ADD(3050146, 0, 1)
DBPATCH_ADD(3050147, 0, 1)
DBPATCH_ADD(3050148, 0, 1)
DBPATCH_ADD(3050149, 0, 1)
DBPATCH_ADD(3050150, 0, 1)
DBPATCH_ADD(3050151, 0, 1)
DBPATCH_ADD(3050152, 0, 1)
DBPATCH_ADD(3050153, 0, 1)
DBPATCH_ADD(3050154, 0, 1)
DBPATCH_ADD(3050155, 0, 1)
DBPATCH_ADD(3050156, 0, 1)
DBPATCH_ADD(3050157, 0, 1)
DBPATCH_ADD(3050158, 0, 1)
DBPATCH_ADD(3050159, 0, 1)
DBPATCH_ADD(3050160, 0, 1)
DBPATCH_ADD(3050161, 0, 1)
DBPATCH_ADD(3050162, 0, 1)
DBPATCH_END()
|