1
0
Fork 0

Converting timezone in admin queues

This commit is contained in:
Unknown 2018-08-06 09:30:17 +02:00
parent ef1c73fb6b
commit e4049d2793

View file

@ -746,11 +746,21 @@ function admin_page_federation(App $a)
function admin_page_queue(App $a)
{
// get content from the queue table
// PLEASE REVIEW (not 100% sure about my code)
$statement = DBA::Select('`queue` AS `q`, `contact` AS `c`',
[ '`c`.`name`', '`c`.`nurl`', '`q`.`id`', '`q`.`network`', "CONVERT_TZ(`q`.`created`, 'UTC' " . Config::get('system', 'default_timezone') . ') as created', "CONVERT_TZ(`q`.`last`, 'UTC', " . Config::get('system', 'default_timezone') . "') as last" ],
'`c`.`id`' => '`q`.`cid`',
['order'=> ['`q`.`cid`, `q`.`created`']]
);
$r = DBA::toArray($statement);
/*
// Leaving this one here for the code review as well as backup
$r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last`
FROM `queue` AS `q`, `contact` AS `c`
WHERE `c`.`id` = `q`.`cid`
ORDER BY `q`.`cid`, `q`.`created`;");
*/
$t = get_markup_template('admin/queue.tpl');
return replace_macros($t, [
'$title' => L10n::t('Administration'),
@ -781,7 +791,7 @@ function admin_page_queue(App $a)
function admin_page_workerqueue(App $a)
{
// get jobs from the workerqueue table
$statement = DBA::select('workerqueue', ['id', 'parameter', 'created', 'priority'], ['done' => 0], ['order'=> ['priority']]);
$statement = DBA::select('workerqueue', ['id', 'parameter', "CONVERT_TZ(created', 'UTC', " . Config::get('system', 'default_timezone') . "') as created", 'priority'], ['done' => 0], ['order'=> ['priority']]);
$r = DBA::toArray($statement);
foreach ($r as $key => $rr) {