/** * Validate pmadb config * * @param string $path * @param array $values * * @return array */ function validate_pmadb($path, $values) { $result = array('Server_pmadb' => '', 'Servers/1/controluser' => '', 'Servers/1/controlpass' => ''); $error = false; if ($values['Servers/1/pmadb'] == '') { return $result; } $result = array(); if ($values['Servers/1/controluser'] == '') { $result['Servers/1/controluser'] = __('Empty phpMyAdmin control user while using pmadb'); $error = true; } if ($values['Servers/1/controlpass'] == '') { $result['Servers/1/controlpass'] = __('Empty phpMyAdmin control user password while using pmadb'); $error = true; } if (!$error) { $test = test_db_connection($values['Servers/1/extension'], $values['Servers/1/connect_type'], $values['Servers/1/host'], $values['Servers/1/port'], $values['Servers/1/socket'], $values['Servers/1/controluser'], $values['Servers/1/controlpass'], 'Server_pmadb'); if ($test !== true) { $result = array_merge($result, $test); } } return $result; }
<?php require_once "tests.php"; // function returns associative array $res[1] = test_db_connection(); $res[2] = test_url(PI_URL); //$res[3] = test_url(PORTAL_URL); $res[3] = test_url(SERVER_BASE_URL); $counts = array("ok" => 0, "warn" => 0, "error" => 0); foreach ($res as $r) { $counts[$r["status"]]++; } /* If there is an error, counts["error"] is incremented, e.g. Array ( [ok] => 0 [warn] => 0 [error] => 1 ) */ /* If someone wants to test the failure, they can fake one using * the fake_failure parameter */ if (isset($_REQUEST['fake_failure'])) { header("HTTP/1.0 500"); echo "GOCDB Web Portal is unable to connect to the GOCDB back end database\n"; die; } if ($counts["error"] != 0) { header("HTTP/1.0 500"); echo "GOCDB Web Portal is unable to connect to the GOCDB back end database\n";
/** * Validate pmadb config * * @param string $path * @param array $values * @return array */ function validate_pmadb($path, $values) { $tables = array('Servers/1/bookmarktable', 'Servers/1/relation', 'Servers/1/table_info', 'Servers/1/table_coords', 'Servers/1/pdf_pages', 'Servers/1/column_info', 'Servers/1/history', 'Servers/1/designer_coords'); $result = array('Server_pmadb' => '', 'Servers/1/controluser' => '', 'Servers/1/controlpass' => ''); $error = false; if ($values['Servers/1/pmadb'] == '') { return $result; } $result = array(); if ($values['Servers/1/controluser'] == '') { $result['Servers/1/controluser'] = PMA_lang('error_empty_pmadb_user'); $error = true; } if ($values['Servers/1/controlpass'] == '') { $result['Servers/1/controlpass'] = PMA_lang('error_empty_pmadb_password'); $error = true; } if (!$error) { $test = test_db_connection($values['Servers/1/extension'], $values['Servers/1/connect_type'], $values['Servers/1/host'], $values['Servers/1/port'], $values['Servers/1/socket'], $values['Servers/1/controluser'], $values['Servers/1/controlpass'], 'Server_pmadb'); if ($test !== true) { $result = array_merge($result, $test); } } return $result; }
<?php echo "<br/><H1 align='center'>GOCDB MONITOR</H1><hr/>"; require_once __DIR__ . '/tests.php'; echo "URL's as defined by local_info.xml<br>"; echo "PI URL is: " . PI_URL . "<br>"; echo "Portal URl is: " . PORTAL_URL . "<br>"; echo "Server Base URL is: " . SERVER_BASE_URL . "<br>"; // GOCDB5 DB connection $res = test_db_connection(); $test_statuses["GOCDB5 DB connection"] = $res["status"]; $test_messages["GOCDB5 DB connection"] = $res["message"]; // GOCDBPI v5 $res = test_url(PI_URL); $test_statuses["GOCDBPI_v5 availability"] = $res["status"]; $test_messages["GOCDBPI_v5 availability"] = $res["message"]; // GOCDB5 web portal $res = test_url(SERVER_BASE_URL); $test_statuses["GOCDB5 central portal availability"] = $res["status"]; $test_messages["GOCDB5 central portal availability"] = $res["message"]; // DISPLAY RESULTS echo "<H2>Service status overview</H2>"; echo "<table border=1 cellspacing=0 cellpadding=5>"; echo "<tr><td><b>Test</b></td><td><b>Status</b></td><td><b>Details</b></td><td><b>Doc/help</b></td></tr>"; foreach ($test_statuses as $test => $status) { echo "<tr><td><font size='1'><span title=\"" . $test_desc[$test] . "\">\n\t {$test}</span></font></td>" . $disp[$status] . "<td><font size='1'>" . $test_messages[$test] . "</font></td><td><font size='1'>" . $test_doc[$test] . "</font></td></tr>"; } echo "</table>"; echo "<hr/><br/><br/>"; echo "<H2>Other tests and check pages</H2>"; echo "<ul>";