aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-04-25 01:00:39 +0000
committerrvelices <rv-github@modusoptimus.com>2008-04-25 01:00:39 +0000
commit94aa1b52822c599229db9933c4d5678484afe467 (patch)
tree8282faeb5e9635c54d212f4d5613d2c462d1bced /include/functions.inc.php
parent23fcaf6b6493c8d479a30201ea9fff3e5cffe4ff (diff)
- minor sql query optimizations
git-svn-id: http://piwigo.org/svn/trunk@2308 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions.inc.php25
1 files changed, 6 insertions, 19 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index be071e349..624e84934 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -564,19 +564,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.'
(
@@ -596,12 +583,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').',