2009-02-26 Esteban Sanchez <estebans@artica.es>

* include/functions_db.php: Added support for queries elapsed time in
	print_database_debug().

	* operation/events/events.php: Style correction.

	* reporting/fgraph.php: Allow boolean graphics to get a starting date.

	* general/footer.php: Use config['debug'] instead of developer_bypass.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1487 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Esteban Sanchez 2009-02-26 09:08:48 +00:00
parent 88b817ee9b
commit c7d84b29c2
5 changed files with 34 additions and 12 deletions

View File

@ -1,3 +1,14 @@
2009-02-26 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Added support for queries elapsed time in
print_database_debug().
* operation/events/events.php: Style correction.
* reporting/fgraph.php: Allow boolean graphics to get a starting date.
* general/footer.php: Use config['debug'] instead of developer_bypass.
2009-02-25 Esteban Sanchez <estebans@artica.es>
* include/functions_ui.php: Fixed typo that makes incorrect argument

View File

@ -26,7 +26,7 @@ if (isset($_SERVER['REQUEST_TIME'])) {
echo '<a class="white_bold" target="_blank" href="general/license/pandora_info_'.$config["language"].'.html">Pandora FMS '.$pandora_version.' - Build '.$build_version.'</a><br />';
echo '<a class="white">'. __('Page generated at') . ' '. print_timestamp ($time, true, array ("prominent" => "timestamp")); //Always use timestamp here
if ((isset($develop_bypass)) AND ($develop_bypass == 1)) {
if (isset ($config['debug'])) {
echo ' - Saved '.format_numeric ($sql_cache["saved"]).' Queries';
}
echo '</a><br />';

View File

@ -1753,7 +1753,9 @@ function process_sql ($sql, $rettype = "affected_rows") {
$sql_cache['saved']++;
add_database_debug_trace ($sql);
} else {
$start = microtime (true);
$result = mysql_query ($sql);
$time = microtime (true) - $start;
if ($result === false) {
$backtrace = debug_backtrace ();
$error = sprintf ('%s (\'%s\') in <strong>%s</strong> on line %d',
@ -1772,10 +1774,12 @@ function process_sql ($sql, $rettype = "affected_rows") {
$result = mysql_affected_rows ();
}
add_database_debug_trace ($sql, $result, mysql_affected_rows ());
add_database_debug_trace ($sql, $result, mysql_affected_rows (),
array ('time' => $time));
return $result;
} else {
add_database_debug_trace ($sql, 0, mysql_affected_rows ());
add_database_debug_trace ($sql, 0, mysql_affected_rows (),
array ('time' => $time));
while ($row = mysql_fetch_array ($result)) {
array_push ($retval, $row);
}
@ -2916,6 +2920,7 @@ function print_database_debug () {
$table->size[2] = '30%';
$table->size[3] = '40px';
$table->size[4] = '40px';
$table->size[5] = '40px';
$table->data = array ();
$table->head = array ();
$table->head[0] = '#';
@ -2923,6 +2928,7 @@ function print_database_debug () {
$table->head[2] = __('Result');
$table->head[3] = __('Rows');
$table->head[4] = __('Saved');
$table->head[5] = __('Time (ms)');
if (! isset ($config['db_debug']))
$config['db_debug'] = array ();
@ -2935,6 +2941,7 @@ function print_database_debug () {
$data[2] = (empty ($debug['result']) ? __('OK') : $debug['result']);
$data[3] = $debug['affected'];
$data[4] = $debug['saved'];
$data[5] = (isset ($debug['extra']['time']) ? format_numeric ($debug['extra']['time'] * 1000, 0) : '');
array_push ($table->data, $data);

View File

@ -29,17 +29,17 @@ if (! give_acl ($config["id_user"], 0, "IR")) {
exit;
}
$delete = get_parameter ("delete");
$validate = get_parameter ("validate");
$delete = (bool) get_parameter ("delete");
$validate = (bool) get_parameter ("validate");
//Process deletion (pass array or single value)
if (!empty ($delete)) {
if ($delete) {
$eventid = (array) get_parameter ("eventid", -1);
$return = delete_event ($eventid); //This function handles both single values as well arrays and cleans up before deleting
print_error_message ($return, __('Events successfully deleted'), __('There was an error deleting events'));
}
//Process validation (pass array or single value)
if (!empty ($validate)) {
if ($validate) {
$eventid = (array) get_parameter ("eventid", -1);
$return = process_event_validate ($eventid);
print_error_message ($return, __('Events successfully validated'), __('There was an error validating events'));
@ -50,7 +50,7 @@ if (!empty ($validate)) {
// Main code form / page
// ***********************************************************************
$offset = (int) get_parameter ( "offset", 0);
$offset = (int) get_parameter ("offset", 0);
$ev_group = (int) get_parameter ("ev_group", 1); //1 = all
$search = preg_replace ("/&([A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "%", rawurldecode (get_parameter ("search"))); //Replace all types of &# HTML with % so that it doesn't fail on quotes
@ -471,4 +471,4 @@ unset ($table);
});
});
/* ]]> */
</script>
</script>

View File

@ -1613,13 +1613,16 @@ function odo_tactic ($value1, $value2, $value3) {
}
function grafico_modulo_boolean ( $id_agente_modulo, $periodo, $show_event,
$width, $height , $title, $unit_name, $show_alert, $avg_only = 0, $pure=0 ) {
$width, $height , $title, $unit_name, $show_alert, $avg_only = 0, $pure=0, $date = 0 ) {
global $config;
$resolution = $config['graph_res'] * 50; // Number of "slices" we want in graph
$fechatope = get_system_time () - $periodo; // limit date
if (! $date)
$date = get_system_time ();
//$unix_timestamp = strtotime($mysql_timestamp) // Convert MYSQL format tio utime
$fechatope = $date - $periodo; // limit date
$horasint = $periodo / $resolution; // Each intervalo is $horasint seconds length
$id_agente = get_agentmodule_agent ($id_agente_modulo);
$nombre_agente = get_agent_name ($id_agente);
@ -1697,6 +1700,7 @@ function grafico_modulo_boolean ( $id_agente_modulo, $periodo, $show_event,
if ($result === false) {
$result = array ();
}
foreach ($result as $row) {
$datos = $row["datos"];
$utimestamp = $row["utimestamp"];
@ -1967,7 +1971,7 @@ if ($graphic_type) {
$label, $unit_name, $draw_alerts, $avg_only, $pure, $date);
break;
case "boolean":
grafico_modulo_boolean ($id, $period, $draw_events, $width, $height , $label, $unit_name, $draw_alerts, 1, $pure);
grafico_modulo_boolean ($id, $period, $draw_events, $width, $height , $label, $unit_name, $draw_alerts, 1, $pure, $date);
break;
case "estado_incidente":