Bug 1717 fixed : SQLite: access failure on Admin > Tools > History
hour function doesn't exists Merge from trunk. git-svn-id: http://piwigo.org/svn/branches/2.1@6464 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
cb00a22449
commit
e49ff390d3
3 changed files with 17 additions and 2 deletions
|
@ -116,14 +116,17 @@ check_status(ACCESS_ADMINISTRATOR);
|
|||
$query = '
|
||||
SELECT
|
||||
date,
|
||||
HOUR(time) AS hour,
|
||||
hour(time) AS hour,
|
||||
MAX(id) AS max_id,
|
||||
COUNT(*) AS nb_pages
|
||||
FROM '.HISTORY_TABLE.'
|
||||
WHERE summarized = \'false\'
|
||||
GROUP BY
|
||||
date,
|
||||
hour
|
||||
ORDER BY
|
||||
date ASC,
|
||||
HOUR(time) ASC
|
||||
hour ASC
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ function pwg_db_connect($host, $user, $password, $database)
|
|||
}
|
||||
|
||||
$link->sqliteCreateFunction('now', 'pwg_now', 0);
|
||||
$link->sqliteCreateFunction('hour', 'pwg_hour', 1);
|
||||
$link->sqliteCreateFunction('unix_timestamp', 'pwg_unix_timestamp', 0);
|
||||
$link->sqliteCreateFunction('md5', 'md5', 1);
|
||||
$link->sqliteCreateFunction('if', 'pwg_if', 3);
|
||||
|
@ -570,6 +571,11 @@ function pwg_now()
|
|||
return date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
function pwg_hour($datetime)
|
||||
{
|
||||
return strftime('%H', $datetime);
|
||||
}
|
||||
|
||||
function pwg_unix_timestamp()
|
||||
{
|
||||
return time();
|
||||
|
|
|
@ -55,6 +55,7 @@ function pwg_db_connect($host, $user, $password, $database)
|
|||
}
|
||||
|
||||
$link->createFunction('now', 'pwg_now', 0);
|
||||
$link->createFunction('hour', 'pwg_hour', 1);
|
||||
$link->createFunction('unix_timestamp', 'pwg_unix_timestamp', 0);
|
||||
$link->createFunction('md5', 'md5', 1);
|
||||
$link->createFunction('if', 'pwg_if', 3);
|
||||
|
@ -582,6 +583,11 @@ function pwg_now()
|
|||
return date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
function pwg_hour($datetime)
|
||||
{
|
||||
return strftime('%H', $datetime);
|
||||
}
|
||||
|
||||
function pwg_unix_timestamp()
|
||||
{
|
||||
return time();
|
||||
|
|
Loading…
Add table
Reference in a new issue