From f95f48a226118dd541130e2cec8e18fd13bff128 Mon Sep 17 00:00:00 2001 From: rvelices Date: Fri, 25 Apr 2008 23:39:06 +0000 Subject: - merge r2308 and r2309 from trunk to branch-1_7 - minor mysql query optimizations - less mysql queries on the picture page (under some circumstances) git-svn-id: http://piwigo.org/svn/branches/branch-1_7@2310 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions.inc.php | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) (limited to 'include/functions.inc.php') diff --git a/include/functions.inc.php b/include/functions.inc.php index d1756a82f..9b8dea1a3 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -533,19 +533,6 @@ function pwg_log($image_id = null, $image_type = null) $tags_string = implode(',', $tag_ids); } - // here we ask the database the current date and time, and we extract - // {year, month, day} from the current date. We could do this during the - // insert query with a CURDATE(), CURTIME(), DATE_FORMAT(CURDATE(), '%Y') - // ... but I (plg) think it would cost more than a double query and a PHP - // extraction. - $query = ' -SELECT CURDATE(), CURTIME() -;'; - list($curdate, $curtime) = mysql_fetch_row(pwg_query($query)); - - list($curyear, $curmonth, $curday) = explode('-', $curdate); - list($curhour) = explode(':', $curtime); - $query = ' INSERT INTO '.HISTORY_TABLE.' ( @@ -565,12 +552,12 @@ INSERT INTO '.HISTORY_TABLE.' ) VALUES ( - \''.$curdate.'\', - \''.$curtime.'\', - '.$curyear.', - '.$curmonth.', - '.$curday.', - '.$curhour.', + CURDATE(), + CURTIME(), + YEAR( CURDATE() ), + MONTH( CURDATE() ), + DAYOFMONTH( CURDATE() ), + HOUR( CURTIME() ), '.$user['id'].', \''.$_SERVER['REMOTE_ADDR'].'\', '.(isset($page['section']) ? "'".$page['section']."'" : 'NULL').', -- cgit v1.2.3