- upgrade scripts added for releases 1.3.x

- my_error function moved from admin/include/functions.php to
  include/functions.inc.php

- because MySQL temporary tables are not always authorized on creation, use
  a temporary table name (with the current microsecond) on a non temporary
  table (in mass_updates function)

- ability to retrieve distant full directories (usefull in upgrade scripts)

- global variables $count_queries and $queries_time moved into global array
  $page

- get_cat_display_name displays category names in correct order : the one
  given by uppercats

- function setup_style simplified

- default value for configuration parameter "show_nb_comments" set to false
  (less queries by default)


git-svn-id: http://piwigo.org/svn/trunk@672 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
plegall
2005-01-06 22:16:21 +00:00
parent 22e0536a05
commit 79c440d8bb
12 changed files with 2129 additions and 59 deletions

View File

@@ -486,21 +486,31 @@ function pwg_write_debug()
function pwg_query($query)
{
global $conf,$count_queries,$queries_time;
global $conf,$page;
$start = get_moment();
$result = mysql_query($query);
$result = mysql_query($query) or my_error($query."\n");
$time = get_moment() - $start;
$count_queries++;
$queries_time+= $time;
if (!isset($page['count_queries']))
{
$page['count_queries'] = 0;
$page['queries_time'] = 0;
}
$page['count_queries']++;
$page['queries_time']+= $time;
if ($conf['show_queries'])
{
$output = '';
$output.= '<pre>['.$count_queries.'] '."\n".$query;
$output.= "\n".'(this query time : '.number_format( $time, 3, '.', ' ').' s)</b>';
$output.= "\n".'(total SQL time : '.number_format( $queries_time, 3, '.', ' ').' s)';
$output.= '<pre>['.$page['count_queries'].'] ';
$output.= "\n".$query;
$output.= "\n".'(this query time : ';
$output.= number_format($time, 3, '.', ' ').' s)</b>';
$output.= "\n".'(total SQL time : ';
$output.= number_format($page['queries_time'], 3, '.', ' ').' s)';
$output.= '</pre>';
echo $output;
@@ -624,4 +634,23 @@ function get_thumbnail_src($path, $tn_ext = '')
return $src;
}
// my_error returns (or send to standard output) the message concerning the
// error occured for the last mysql query.
function my_error($header, $echo = true)
{
$error = '<pre>';
$error.= $header;
$error.= '[mysql error '.mysql_errno().'] ';
$error.= mysql_error();
$error.= '</pre>';
if ($echo)
{
echo $error;
}
else
{
return $error;
}
}
?>