streams/Code/Module/Admin/Queue.php

53 lines
1.5 KiB
PHP
Raw Normal View History

<?php
2022-02-16 04:08:28 +00:00
namespace Code\Module\Admin;
2022-02-16 04:08:28 +00:00
use Code\Lib\Queue as ZQueue;
2022-02-16 04:08:28 +00:00
use Code\Render\Theme;
2022-02-12 20:43:29 +00:00
2021-12-02 23:02:31 +00:00
class Queue
{
public function get()
{
$o = '';
$expert = ((array_key_exists('expert', $_REQUEST)) ? intval($_REQUEST['expert']) : 0);
if ($_REQUEST['drophub']) {
hubloc_mark_as_down($_REQUEST['drophub']);
ZQueue::remove_by_posturl($_REQUEST['drophub']);
}
if ($_REQUEST['emptyhub']) {
ZQueue::remove_by_posturl($_REQUEST['emptyhub']);
}
$r = q("select count(outq_posturl) as total, max(outq_priority) as priority, outq_posturl from outq
where outq_delivered = 0 group by outq_posturl order by total desc");
2021-12-02 23:02:31 +00:00
for ($x = 0; $x < count($r); $x++) {
$r[$x]['eurl'] = urlencode($r[$x]['outq_posturl']);
$r[$x]['connected'] = datetime_convert('UTC', date_default_timezone_get(), $r[$x]['connected'], 'Y-m-d');
}
2022-02-12 20:43:29 +00:00
$o = replace_macros(Theme::get_template('admin_queue.tpl'), array(
2021-12-02 23:02:31 +00:00
'$banner' => t('Queue Statistics'),
'$numentries' => t('Total Entries'),
'$priority' => t('Priority'),
'$desturl' => t('Destination URL'),
'$nukehub' => t('Mark hub permanently offline'),
'$empty' => t('Empty queue for this hub'),
'$lastconn' => t('Last known contact'),
'$hasentries' => ((count($r)) ? true : false),
'$entries' => $r,
'$expert' => $expert
));
return $o;
}
2021-12-03 03:01:39 +00:00
}