2009-02-25 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Do not show errors on sql_error_handler() if debug flag is active. Removed return flag to print_database_debug() because it was causing memory allocation errors. For the same reason, the table is printed each 100 elements. * index.php: Run print_database_debug() after the flush. * include/functions.php: Removed deprecated pandora_debug() git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1484 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
8130c5a1e1
commit
daf7d5eeb5
|
@ -1,3 +1,14 @@
|
|||
2009-02-25 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* include/functions_db.php: Do not show errors on sql_error_handler()
|
||||
if debug flag is active. Removed return flag to print_database_debug()
|
||||
because it was causing memory allocation errors. For the same reason,
|
||||
the table is printed each 100 elements.
|
||||
|
||||
* index.php: Run print_database_debug() after the flush.
|
||||
|
||||
* include/functions.php: Removed deprecated pandora_debug()
|
||||
|
||||
2009-02-25 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* include/functions_db.php: Added database debug support. If the debug
|
||||
|
|
|
@ -79,20 +79,6 @@ function safe_int ($value, $min = false, $max = false) {
|
|||
return $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* It prints a variable value and a message.
|
||||
* TODO: Expand this to handle mixed variables
|
||||
*
|
||||
* @param mixed variable to be displayed
|
||||
* @param string Message to be displayed
|
||||
*
|
||||
* @return string Variable with message and Pandora DEBUG identifier
|
||||
*/
|
||||
function pandora_debug ($var, $msg = '') {
|
||||
echo "[Pandora DEBUG (".$var."): (".$msg.")<br />";
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use get_parameter or safe_input functions
|
||||
*
|
||||
|
|
|
@ -1677,6 +1677,12 @@ function get_db_all_rows_filter ($table, $filter, $fields = false, $where_join =
|
|||
* @return bool True if error level is lower or equal than errno.
|
||||
*/
|
||||
function sql_error_handler ($errno, $errstr) {
|
||||
global $config;
|
||||
|
||||
/* If debug is activated, the database debug table will show the error */
|
||||
if (isset ($config['debug']))
|
||||
return false;
|
||||
|
||||
if (error_reporting () <= $errno)
|
||||
return false;
|
||||
echo "<strong>SQL error</strong>: ".$errstr."<br />\n";
|
||||
|
@ -2891,19 +2897,14 @@ function get_group_users ($id_group, $filter = false) {
|
|||
* Prints a database debug table with all the queries done in the page loading.
|
||||
*
|
||||
* This functions does nothing if the config['debug'] flag is not set.
|
||||
*
|
||||
* @param bool Wheter to return the table or print it.
|
||||
*
|
||||
* @return string If $return was set, the table is returned.
|
||||
*/
|
||||
function print_database_debug ($return = false) {
|
||||
function print_database_debug () {
|
||||
global $config;
|
||||
|
||||
if (! isset ($config['debug']))
|
||||
return '';
|
||||
|
||||
$output = '';
|
||||
$output = '<div class="database_debug_title">'.__('Database debug').'</div>';
|
||||
echo '<div class="database_debug_title">'.__('Database debug').'</div>';
|
||||
|
||||
$table->id = 'database_debug';
|
||||
$table->cellpadding = '0';
|
||||
|
@ -2931,16 +2932,18 @@ function print_database_debug ($return = false) {
|
|||
|
||||
$data[0] = $i++;
|
||||
$data[1] = $debug['sql'];
|
||||
$data[2] = (($debug['result'] == 0) ? __('OK') : $debug['result']);
|
||||
$data[2] = (empty ($debug['result']) ? __('OK') : $debug['result']);
|
||||
$data[3] = $debug['affected'];
|
||||
$data[4] = $debug['saved'];
|
||||
|
||||
array_push ($table->data, $data);
|
||||
|
||||
if (($i % 100) == 0) {
|
||||
print_table ($table);
|
||||
$table->data = array ();
|
||||
}
|
||||
}
|
||||
$output .= print_table ($table, true);
|
||||
|
||||
if ($return)
|
||||
return $output;
|
||||
echo $output;
|
||||
print_table ($table);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -250,9 +250,8 @@ if ($config["pure"] == 0) {
|
|||
echo '</div>';
|
||||
echo '</div>'; //container div
|
||||
}
|
||||
while (@ob_end_flush ());
|
||||
|
||||
print_database_debug ();
|
||||
|
||||
while (@ob_end_flush ());
|
||||
echo '</html>';
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue