aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-03-01 15:55:27 -0800
committerfriendica <info@friendica.com>2015-03-01 15:55:27 -0800
commitba7bdd79b720dcb58dfd88a38f43444eb4da06f4 (patch)
treed9b89756a135b047366832c2c1a6c68f97af6db7
parentced19bf7d81a328cbf3d29bb701685c27319a473 (diff)
downloadvolse-hubzilla-ba7bdd79b720dcb58dfd88a38f43444eb4da06f4.tar.gz
volse-hubzilla-ba7bdd79b720dcb58dfd88a38f43444eb4da06f4.tar.bz2
volse-hubzilla-ba7bdd79b720dcb58dfd88a38f43444eb4da06f4.zip
queue management actions. Still needs further work such as indication of last successful connection or indication that the hub was marked offline, but these are potentially expensive queries.
-rw-r--r--include/hubloc.php5
-rw-r--r--mod/admin.php39
-rw-r--r--version.inc2
-rw-r--r--view/en/htconfig.tpl1
-rw-r--r--view/tpl/admin_queue.tpl14
5 files changed, 49 insertions, 12 deletions
diff --git a/include/hubloc.php b/include/hubloc.php
index 94f1dc985..98c1a21f3 100644
--- a/include/hubloc.php
+++ b/include/hubloc.php
@@ -175,8 +175,9 @@ function hubloc_change_primary($hubloc) {
// The https might be alive, and the http dead.
function hubloc_mark_as_down($posturl) {
- $r = q("update hubloc set hubloc_status = ( hubloc_status | %d ) where hubloc_posturl = '%s'",
- intval(HUBLOC_OFFLINE)
+ $r = q("update hubloc set hubloc_status = ( hubloc_status | %d ) where hubloc_callback = '%s'",
+ intval(HUBLOC_OFFLINE),
+ dbesc($posturl)
);
}
diff --git a/mod/admin.php b/mod/admin.php
index 98b2f4266..f97c15786 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -590,19 +590,42 @@ function admin_page_dbsync(&$a) {
function admin_page_queue($a) {
$o = '';
- $r = q("select count(outq_posturl) as total, outq_posturl from outq
+ $r = q("select count(outq_posturl) as total, outq_posturl, max(hubloc_connected) as connected from outq
where outq_delivered = 0 group by outq_posturl order by total desc");
- $o .= '<h3>' . t('Queue Statistics') . '</h3>';
+ if($_REQUEST['drophub']) {
+ require_once('hubloc.php');
+ hubloc_mark_as_down($_REQUEST['drophub']);
+ }
- if($r) {
- $o .= '<table><tr><td>' . t('Total Entries') . '&nbsp;&nbsp;</td><td>' . t('Destination URL') . '</td></tr>';
- foreach($r as $rr) {
- $o .= '<tr><td>' . $rr['total'] . '</td><td>' . $rr['outq_posturl'] . '</td></tr>';
- }
- $o .= '</table>';
+ if($_REQUEST['emptyhub']) {
+ $r = q("delete from outq where outq_posturl = '%s' ",
+ dbesc($_REQUEST['emptyhub'])
+ );
}
+
+
+ $r = q("select count(outq_posturl) as total, outq_posturl from outq
+ where outq_delivered = 0 group by outq_posturl order by total desc");
+
+ 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');
+ }
+
+
+ $o = replace_macros(get_markup_template('admin_queue.tpl'), array(
+ '$banner' => t('Queue Statistics'),
+ '$numentries' => t('Total Entries'),
+ '$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
+ ));
+
return $o;
}
diff --git a/version.inc b/version.inc
index 448d75763..36fcceb22 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2015-02-27.956
+2015-03-01.958
diff --git a/view/en/htconfig.tpl b/view/en/htconfig.tpl
index d06e5da49..066ae39d8 100644
--- a/view/en/htconfig.tpl
+++ b/view/en/htconfig.tpl
@@ -71,7 +71,6 @@ $a->config['system']['access_policy'] = ACCESS_PRIVATE;
$a->config['system']['sellpage'] = '';
// Maximum size of an imported message, 0 is unlimited
-// FIXME - NOT currently implemented.
$a->config['system']['max_import_size'] = 200000;
diff --git a/view/tpl/admin_queue.tpl b/view/tpl/admin_queue.tpl
new file mode 100644
index 000000000..2abe87db9
--- /dev/null
+++ b/view/tpl/admin_queue.tpl
@@ -0,0 +1,14 @@
+<h3>{{$banner}}</h3>
+
+{{if $hasentries}}
+
+<table id="admin-queue-table"><tr><td>{{$numentries}}&nbsp;&nbsp;</td><td>{{$desturl}}</td><td>&nbsp;</td><td>&nbsp;</td></tr>
+
+{{foreach $entries as $e}}
+
+<tr><td>{{$e.total}}</td><td>{{$e.outq_posturl}}</td><td><a href="admin/queue?f=&drophub={{$e.eurl}}" title="{{$nukehub}}" class="btn btn-default"><i class="icon-remove"></i><a></td><td><a href="admin/queue?f=&emptyhub={{$e.eurl}}" title="{{$empty}}" class="btn btn-default"><i class="icon-trash"></i></a></td></tr>
+{{/foreach}}
+
+</table>
+
+{{/if}} \ No newline at end of file