fixup the previous commit
[racktables] / wwwroot / inc / dictionary.php
index 0dcd4b7..dde7180 100644 (file)
@@ -51,11 +51,6 @@ function isInnoDBSupported ()
        return $innodb_row['Engine'] == 'InnoDB' && $trigger_row['count'] == 1;
 }
 
-function platform_function_test ($funcname, $extname, $what_if_not = 'not found', $error_class = 'trerror')
-{
-       return platform_generic_test (function_exists ($funcname), $extname, 'NOT PRESENT', $error_class);
-}
-
 function platform_generic_test ($is_ok, $topic, $what_if_not = 'FAILED', $error_class = 'trerror')
 {
        echo "<tr><th class=tdleft>${topic}</th>";
@@ -76,22 +71,102 @@ function pcre8_with_properties()
 // Check for PHP extensions.
 function platform_is_ok ($test_innodb = FALSE)
 {
+       $extlist = array
+       (
+               // mandatory
+               array
+               (
+                       'name' => 'PDO',
+                       'comment' => 'PHP data objects',
+               ),
+               array
+               (
+                       'name' => 'pdo_mysql',
+                       'comment' => 'PDO MySQL driver',
+               ),
+               array
+               (
+                       'name' => 'pcre',
+                       'comment' => 'PCRE',
+               ),
+               array
+               (
+                       'name' => 'gd',
+                       'comment' => 'GD and image',
+               ),
+               array
+               (
+                       'name' => 'mbstring',
+                       'comment' => 'multibyte string',
+               ),
+               array
+               (
+                       'name' => 'json',
+                       'comment' => 'JSON',
+               ),
+               array
+               (
+                       'name' => 'bcmath',
+                       'comment' => 'arbitrary precision mathematics',
+               ),
+               // optional
+               array
+               (
+                       'name' => 'snmp',
+                       'comment' => 'SNMP',
+                       'impact' => 'SNMP sync feature will not work',
+               ),
+               array
+               (
+                       'name' => 'ldap',
+                       'comment' => 'LDAP',
+                       'impact' => 'LDAP authentication will not work',
+               ),
+               array
+               (
+                       'name' => 'curl',
+                       'comment' => 'client URL library',
+                       'impact' => 'some plugins may not work',
+               ),
+               array
+               (
+                       'name' => 'pcntl',
+                       'comment' => 'process control',
+                       'impact' => '802.1Q parallel sync will not work',
+               ),
+       );
        $nerrs = 0;
        echo "<table border=1 cellpadding=5>\n";
        $nerrs += platform_generic_test (version_compare (PHP_VERSION, '5.5.0', '>='), 'PHP version >= 5.5.0');
-       $nerrs += platform_generic_test (class_exists ('PDO'), 'PDO extension');
-       $nerrs += platform_generic_test (in_array  ('pdo_mysql', get_loaded_extensions()), 'PDO-MySQL extension');
+       foreach ($extlist as $e)
+       {
+               if (array_key_exists ('impact', $e))
+               {
+                       // When an optional PHP extension is not available, display a warning and a message
+                       // with some additional information so that the user can decide if it is OK to proceed
+                       // without the feature(s) that depend on the extension.
+                       $what_if_not = "Not found ({$e['impact']}).";
+                       $error_class = 'trwarning';
+                       $c = 0;
+               }
+               else
+               {
+                       // If a mandatory PHP extension is not available, just report the failure.
+                       $what_if_not = 'Not found.';
+                       $error_class = 'trerror';
+                       $c = 1;
+               }
+               $nerrs += $c * platform_generic_test
+               (
+                       extension_loaded ($e['name']),
+                       "{$e['comment']} extension ({$e['name']})",
+                       $what_if_not,
+                       $error_class
+               );
+       }
        if ($test_innodb)
                $nerrs += platform_generic_test (isInnoDBSupported(), 'InnoDB support');
-       $nerrs += platform_function_test ('preg_match', 'PCRE extension');
        $nerrs += platform_generic_test (pcre8_with_properties(), 'PCRE compiled with<br>--enable-unicode-properties');
-       platform_function_test ('snmpwalk', 'SNMP extension', 'Not found, Live SNMP feature will not work.', 'trwarning');
-       $nerrs += platform_function_test ('gd_info', 'GD extension');
-       $nerrs += platform_function_test ('mb_strlen', 'Multibyte string extension');
-       platform_function_test ('ldap_connect', 'LDAP extension', 'Not found, LDAP authentication will not work.', 'trwarning');
-       platform_function_test ('pcntl_waitpid', 'PCNTL extension', '802.1Q parallel sync is unavailable.', 'trwarning');
-       $nerrs += platform_function_test ('json_encode', 'JSON extension', 'JavaScript interface bits may fail.');
-       $nerrs += platform_function_test ('bcmul', 'BC Math extension');
        platform_generic_test
        (
                (! empty ($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'),
@@ -103,6 +178,96 @@ function platform_is_ok ($test_innodb = FALSE)
        return !$nerrs;
 }
 
+// FIXME: Use this in the installer instead of the hardcoded SQL.
+function getConfigDefaults()
+{
+       return array
+       (
+               'MASSCOUNT' => '8',
+               'MAXSELSIZE' => '30',
+               'ROW_SCALE' => '2',
+               'IPV4_ADDRS_PER_PAGE' => '256',
+               'DEFAULT_RACK_HEIGHT' => '42',
+               'DEFAULT_SLB_VS_PORT' => '',
+               'DEFAULT_SLB_RS_PORT' => '',
+               'DETECT_URLS' => 'no',
+               'RACK_PRESELECT_THRESHOLD' => '1',
+               'DEFAULT_IPV4_RS_INSERVICE' => 'no',
+               'AUTOPORTS_CONFIG' => '4 = 1*33*kvm + 2*24*eth%u;15 = 1*446*kvm',
+               'SHOW_EXPLICIT_TAGS' => 'yes',
+               'SHOW_IMPLICIT_TAGS' => 'yes',
+               'SHOW_AUTOMATIC_TAGS' => 'no',
+               'DEFAULT_OBJECT_TYPE' => '4',
+               'IPV4_AUTO_RELEASE' => '1',
+               'SHOW_LAST_TAB' => 'yes',
+               'EXT_IPV4_VIEW' => 'yes',
+               'TREE_THRESHOLD' => '25',
+               'IPV4_JAYWALK' => 'no',
+               'ADDNEW_AT_TOP' => 'yes',
+               'IPV4_TREE_SHOW_USAGE' => 'no',
+               'PREVIEW_TEXT_MAXCHARS' => '10240',
+               'PREVIEW_TEXT_ROWS' => '25',
+               'PREVIEW_TEXT_COLS' => '80',
+               'PREVIEW_IMAGE_MAXPXS' => '320',
+               'VENDOR_SIEVE' => '',
+               'IPV4LB_LISTSRC' => 'false',
+               'IPV4OBJ_LISTSRC' => 'not ({$typeid_3} or {$typeid_9} or {$typeid_10} or {$typeid_11})',
+               'IPV4NAT_LISTSRC' => '{$typeid_4} or {$typeid_7} or {$typeid_8} or {$typeid_798}',
+               'ASSETWARN_LISTSRC' => '{$typeid_4} or {$typeid_7} or {$typeid_8}',
+               'NAMEWARN_LISTSRC' => '{$typeid_4} or {$typeid_7} or {$typeid_8}',
+               'RACKS_PER_ROW' => '12',
+               'FILTER_PREDICATE_SIEVE' => '',
+               'FILTER_DEFAULT_ANDOR' => 'and',
+               'FILTER_SUGGEST_ANDOR' => 'yes',
+               'FILTER_SUGGEST_TAGS' => 'yes',
+               'FILTER_SUGGEST_PREDICATES' => 'yes',
+               'FILTER_SUGGEST_EXTRA' => 'no',
+               'DEFAULT_SNMP_COMMUNITY' => 'public',
+               'IPV4_ENABLE_KNIGHT' => 'yes',
+               'TAGS_TOPLIST_SIZE' => '50',
+               'TAGS_QUICKLIST_SIZE' => '20',
+               'TAGS_QUICKLIST_THRESHOLD' => '50',
+               'ENABLE_MULTIPORT_FORM' => 'no',
+               'DEFAULT_PORT_IIF_ID' => '1',
+               'DEFAULT_PORT_OIF_IDS' => '1=24; 3=1078; 4=1077; 5=1079; 6=1080; 8=1082; 9=1084; 10=1588; 11=1668; 12=1589; 13=1590; 14=1591',
+               'IPV4_TREE_RTR_AS_CELL' => 'no',
+               'PROXIMITY_RANGE' => '0',
+               'IPV4_TREE_SHOW_VLAN' => 'yes',
+               'VLANSWITCH_LISTSRC' => '',
+               'VLANNET_LISTSRC' => '',
+               'DEFAULT_VDOM_ID' => '',
+               'DEFAULT_VST_ID' => '',
+               'STATIC_FILTER' => 'yes',
+               '8021Q_DEPLOY_MINAGE' => '300',
+               '8021Q_DEPLOY_MAXAGE' => '3600',
+               '8021Q_DEPLOY_RETRY' => '10800',
+               '8021Q_WRI_AFTER_CONFT_LISTSRC' => 'false',
+               '8021Q_INSTANT_DEPLOY' => 'no',
+               'ENABLE_BULKPORT_FORM' => 'yes',
+               'CDP_RUNNERS_LISTSRC' => '',
+               'LLDP_RUNNERS_LISTSRC' => '',
+               'SHRINK_TAG_TREE_ON_CLICK' => 'yes',
+               'MAX_UNFILTERED_ENTITIES' => '0',
+               'SYNCDOMAIN_MAX_PROCESSES' => '0',
+               'PORT_EXCLUSION_LISTSRC' => '{$typeid_3} or {$typeid_10} or {$typeid_11} or {$typeid_1505} or {$typeid_1506}',
+               'FILTER_RACKLIST_BY_TAGS' => 'yes',
+               'MGMT_PROTOS' => 'ssh: {$typeid_4}; telnet: {$typeid_8}',
+               'SYNC_8021Q_LISTSRC' => '',
+               'QUICK_LINK_PAGES' => 'depot,ipv4space,rackspace',
+               'VIRTUAL_OBJ_CSV' => '1504,1505,1506,1507',
+               'DATETIME_ZONE' => 'UTC',
+               'DATETIME_FORMAT' => '%Y-%m-%d',
+               'DATEONLY_FORMAT' => '%Y-%m-%d',
+               'SEARCH_DOMAINS' => '',
+               '8021Q_EXTSYNC_LISTSRC' => 'false',
+               '8021Q_MULTILINK_LISTSRC' => 'false',
+               'REVERSED_RACKS_LISTSRC' => 'false',
+               'NEAREST_RACKS_CHECKBOX' => 'yes',
+               'SHOW_OBJECTTYPE' => 'yes',
+               'IPV4_TREE_SHOW_UNALLOCATED' => 'yes',
+       );
+}
+
 $dictionary = array
 (
        1 => array ('chapter_id' => 1, 'dict_value' => 'BlackBox'),
@@ -2071,7 +2236,7 @@ $dictionary = array
        2173 => array ('chapter_id' => 17, 'dict_value' => 'MikroTik%GPASS%CCR1009-8G-1S'),
        2174 => array ('chapter_id' => 17, 'dict_value' => 'MikroTik%GPASS%CCR1009-8G-1S-1S+'),
        2175 => array ('chapter_id' => 17, 'dict_value' => 'MikroTik%GPASS%CCR1016-12S-1S+'),
-       2176 => array ('chapter_id' => 12, 'dict_value' => 'HP ProCurve%GPASS%1910-24G'),
+       2176 => array ('chapter_id' => 12, 'dict_value' => 'HP ProCurve%GPASS%1910-24G (JE006A)'),
        2177 => array ('chapter_id' => 13, 'dict_value' => '[[Univention%GSKIP%Univention Corporate Server 3.2 (borgfeld) | http://docs.univention.de/release-notes-3.2-2-de.html]]'),
        2178 => array ('chapter_id' => 27, 'dict_value' => '[[APC%GPASS%AP8941 | http://www.apc.com/products/resource/include/techspec_index.cfm?base_sku=AP8941]]'),
        2179 => array ('chapter_id' => 27, 'dict_value' => '[[APC%GPASS%AP8959EU3 | http://www.apc.com/products/resource/include/techspec_index.cfm?base_sku=AP8959EU3]]'),
@@ -2137,7 +2302,7 @@ $dictionary = array
        2239 => array ('chapter_id' => 12, 'dict_value' => '[[Brocade%GPASS%ICX-6430-48 | http://www.brocade.com/products/all/switches/product-details/icx-6430-and-6450-switches/index.page]]'),
        2240 => array ('chapter_id' => 12, 'dict_value' => '[[Brocade%GPASS%ICX-6450-48 | http://www.brocade.com/products/all/switches/product-details/icx-6430-and-6450-switches/index.page]]'),
        2241 => array ('chapter_id' => 12, 'dict_value' => '[[IBM%GPASS%RackSwitch G8000 | http://www-03.ibm.com/systems/networking/switches/rack/g8000/]]'),
-       2242 => array ('chapter_id' => 12, 'dict_value' => 'HP ProCurve%GPASS%1810G-24'),
+       2242 => array ('chapter_id' => 12, 'dict_value' => 'HP ProCurve%GPASS%1810G-24 (J9450A)'),
        2243 => array ('chapter_id' => 17, 'dict_value' => 'Huawei%GPASS%NE20E-S4'),
        2244 => array ('chapter_id' => 17, 'dict_value' => 'Huawei%GPASS%NE20E-S8'),
        2245 => array ('chapter_id' => 17, 'dict_value' => 'Huawei%GPASS%NE20E-S16'),
@@ -3617,6 +3782,16 @@ $dictionary = array
        3720 => array ('chapter_id' => 14, 'dict_value' => 'HP Procurve OS N.11.78'),
        3721 => array ('chapter_id' => 12, 'dict_value' => '[[HP%GPASS%HP Aruba 2530 48 PoE+ Switch | https://www.hpe.com/us/en/product-catalog/networking/networking-switches/pip.specifications.aruba-2530-48-poeplus-switch.5384996.html]]'),
        3722 => array ('chapter_id' => 12, 'dict_value' => '[[HP%GPASS%HP Aruba 2530 24 PoE+ Switch | https://www.hpe.com/uk/en/product-catalog/networking/networking-switches/pip.specifications.aruba-2530-24-poeplus-switch.5384999.html]]'),
+       3723 => array ('chapter_id' => 12, 'dict_value' => '[[HP%GPASS%HP 1950 48G 2SFP+ 2XGT Switch | https://www.hpe.com/us/en/product-catalog/networking/networking-switches/pip.specifications.hpe-officeconnect-1950-48g-2sfpplus-2xgt-poeplus-switch.6887601.html]]'),
+       3724 => array ('chapter_id' => 12, 'dict_value' => '[[HP%GPASS%HP FlexFabric 5900AF 48XG 4QSFP+ Switch | https://www.hpe.com/us/en/product-catalog/networking/networking-switches/pip.specifications.hpe-flexfabric-5900af-48xg-4qsfpplus-switch.5223200.html]]'),
+       3725 => array ('chapter_id' => 12, 'dict_value' => '[[HP%GPASS%HPE 5500-24G-4SFP | https://h20195.www2.hpe.com/v2/default.aspx?cc=az&lc=az&oid=5195377]]'),
+       3726 => array ('chapter_id' => 12, 'dict_value' => '[[HP%GPASS%HP A5800AF-48G Switch with 2 Processors (JG225A) | https://www.hpe.com/us/en/product-catalog/networking/networking-switches/pip.specifications.hpe-flexfabric-5800af-48g-switch.7482188.html]]'),
+       3727 => array ('chapter_id' => 12, 'dict_value' => '[[HP%GPASS%HP 1810-8G v2 (J9802A)]]'),
+       3728 => array ('chapter_id' => 12, 'dict_value' => '[[HP%GPASS%HP ProCurve 5406zl (J8697A) | http://www.hp.com/hpinfo/newsroom/press_kits/2010/HPOptimizesAppDelivery/E5400zl_Switch_Series_Data_Sheet.pdf]]'),
+       3729 => array ('chapter_id' => 12, 'dict_value' => '[[HP%GPASS%HP 1810-8G v2 (J9449A) | https://h10057.www1.hp.com/ecomcat/hpcatalog/specs/provisioner/99/J9449A.htm]]'),
+       3730 => array ('chapter_id' => 12, 'dict_value' => 'HP ProCurve%GPASS%1810G-24 (J9803A)'),
+       3731 => array ('chapter_id' => 12, 'dict_value' => 'Cisco%GPASS%Cisco 871'),
+       3732 => array ('chapter_id' => 12, 'dict_value' => '[[HP%GPASS%HP A5120-24G EI (JE068A) | [[https://h20195.www2.hpe.com/v2/GetDocument.aspx?docname=c04111657&doctype=quickspecs&doclang=EN_US&searchquery=&cc=za&lc=en]]'),
 
 # Any new "default" dictionary records must go above this line (i.e., with
 # dict_key code less than 50000). This is necessary to keep AUTO_INCREMENT