Rev 557 | Rev 1162 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 557 | Rev 640 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | $context = stream_context_create($options); |
31 | $context = stream_context_create($options); |
32 | $cont = file_get_contents('http://oid-info.com/get/1.2', false, $context). |
32 | $cont = file_get_contents('http://oid-info.com/get/1.2', false, $context). |
33 | file_get_contents('http://oid-info.com/get/2.16', false, $context). |
33 | file_get_contents('http://oid-info.com/get/2.16', false, $context). |
34 | file_get_contents('http://oid-info.com/get/2.49.0.0', false, $context); |
34 | file_get_contents('http://oid-info.com/get/2.49.0.0', false, $context); |
35 | 35 | ||
36 | preg_match_all('@<option value="https{0,1}://(www.){0,1}oid-info.com/get/([^"]+)">(..)\(.+\)</option>@ismU', $cont, $m, PREG_SET_ORDER); |
36 | preg_match_all('@<option value="/get/([^"]+)">(..)\(.+\)</option>@ismU', $cont, $m, PREG_SET_ORDER); |
37 | 37 | ||
38 | echo "-- Country OIDs\n"; |
38 | echo "-- Country OIDs\n"; |
39 | echo "-- Use the tool dev/generate_wellknown_country_pgsql to generate this file\n"; |
39 | echo "-- Use the tool dev/generate_wellknown_country_pgsql to generate this file\n"; |
40 | echo "\n"; |
40 | echo "\n"; |
41 | 41 | ||
42 | $check_sum = ''; |
42 | $check_sum = ''; |
43 | foreach ($m as $n) { |
43 | foreach ($m as $n) { |
44 | $check_sum .= $n[2].'='.$n[3].'/'; |
44 | $check_sum .= $n[1].'='.$n[2].'/'; |
45 | 45 | ||
46 | if (strpos($n[2], '2.49.0.0') === 0) { |
46 | if (strpos($n[1], '2.49.0.0') === 0) { |
47 | // WMO Country OIDs (does not assign Unicode labels), 2.49.0.0 |
47 | // WMO Country OIDs (does not assign Unicode labels), 2.49.0.0 |
48 | echo "INSERT INTO \"asn1id\" (oid, name, standardized, well_known) VALUES ('oid:$n[2]', '$n[3]', false, true);\n"; |
48 | echo "INSERT INTO \"asn1id\" (oid, name, standardized, well_known) VALUES ('oid:$n[1]', '$n[2]', false, true);\n"; |
49 | 49 | ||
50 | // Country-Msg, 2.49.0.1 |
50 | // Country-Msg, 2.49.0.1 |
51 | $n[2] = str_replace('2.49.0.0', '2.49.0.1', $n[2]); |
51 | $n[1] = str_replace('2.49.0.0', '2.49.0.1', $n[1]); |
52 | echo "INSERT INTO \"asn1id\" (oid, name, standardized, well_known) VALUES ('oid:$n[2]', '$n[3]', false, true);\n"; |
52 | echo "INSERT INTO \"asn1id\" (oid, name, standardized, well_known) VALUES ('oid:$n[1]', '$n[2]', false, true);\n"; |
53 | } else { |
53 | } else { |
54 | // ISO or Joint-ISO-ITU-T OID Countries (1.2 and 2.16) |
54 | // ISO or Joint-ISO-ITU-T OID Countries (1.2 and 2.16) |
55 | echo "INSERT INTO \"asn1id\" (oid, name, standardized, well_known) VALUES ('oid:$n[2]', '$n[3]', false, true);\n"; |
55 | echo "INSERT INTO \"asn1id\" (oid, name, standardized, well_known) VALUES ('oid:$n[1]', '$n[2]', false, true);\n"; |
56 | echo "INSERT INTO \"iri\" (oid, name, longarc, well_known) VALUES ('oid:$n[2]', '".strtoupper($n[3])."', false, true);\n"; |
56 | echo "INSERT INTO \"iri\" (oid, name, longarc, well_known) VALUES ('oid:$n[1]', '".strtoupper($n[2])."', false, true);\n"; |
57 | } |
57 | } |
58 | } |
58 | } |
59 | 59 | ||
60 | echo "\n"; |
60 | echo "\n"; |
61 | echo '-- Generator "generate_wellknown_country_pgsql" checksum '.dechex(crc32($check_sum))."\n"; |
61 | echo '-- Generator "generate_wellknown_country_pgsql" checksum '.dechex(crc32($check_sum))."\n"; |