aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/deliver.php8
-rw-r--r--include/deliver_hooks.php29
-rw-r--r--include/event.php5
-rw-r--r--include/notifier.php37
-rw-r--r--mod/admin.php3
-rw-r--r--mod/dreport.php52
-rw-r--r--mod/tasks.php2
-rw-r--r--mod/uexport.php15
-rwxr-xr-xview/tpl/admin_site.tpl1
-rw-r--r--view/tpl/uexport.tpl7
10 files changed, 140 insertions, 19 deletions
diff --git a/include/deliver.php b/include/deliver.php
index 7a43e3d47..82a1ac6df 100644
--- a/include/deliver.php
+++ b/include/deliver.php
@@ -62,9 +62,17 @@ function deliver_run($argv, $argc) {
$result = z_post_url($r[0]['outq_posturl'],$r[0]['outq_msg']);
if($result['success'] && $result['return_code'] < 300) {
logger('deliver: queue post success to ' . $r[0]['outq_posturl'], LOGGER_DEBUG);
+
+ q("update dreport set status = '%s', dreport_time = '%s' where dreport_queue = '%s' limit 1",
+ dbesc('accepted for delivery'),
+ dbesc(datetime_convert()),
+ dbesc($argv[$x])
+ );
+
$y = q("delete from outq where outq_hash = '%s'",
dbesc($argv[$x])
);
+
}
else {
logger('deliver: queue post returned ' . $result['return_code'] . ' from ' . $r[0]['outq_posturl'],LOGGER_DEBUG);
diff --git a/include/deliver_hooks.php b/include/deliver_hooks.php
new file mode 100644
index 000000000..f0d6ba1b1
--- /dev/null
+++ b/include/deliver_hooks.php
@@ -0,0 +1,29 @@
+<?php
+
+
+require_once('include/cli_startup.php');
+require_once('include/zot.php');
+
+
+function deliver_hooks_run($argv, $argc) {
+
+ cli_startup();
+
+ $a = get_app();
+
+ if($argc < 2)
+ return;
+
+
+ $r = q("select * from item where id = '%d'",
+ intval($argv[1])
+ );
+ if($r)
+ call_hooks('notifier_normal',$r[0]);
+
+}
+
+if (array_search(__file__,get_included_files())===0){
+ deliver_hooks_run($argv,$argc);
+ killme();
+}
diff --git a/include/event.php b/include/event.php
index f0a806dfa..e303ad232 100644
--- a/include/event.php
+++ b/include/event.php
@@ -755,12 +755,15 @@ function event_store_item($arr, $event) {
}
}
+
+
$item_arr = array();
$prefix = '';
// $birthday = false;
if($event['type'] === 'birthday') {
- $prefix = t('This event has been added to your calendar.');
+ if(! is_sys_channel($arr['uid']))
+ $prefix = t('This event has been added to your calendar.');
// $birthday = true;
// The event is created on your own site by the system, but appears to belong
diff --git a/include/notifier.php b/include/notifier.php
index fd95d53e2..3b29229cf 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -579,7 +579,7 @@ function notifier_run($argv, $argc){
if($deliveries_per_process <= 0)
$deliveries_per_process = 1;
- $deliver = array();
+ $deliveries = array();
foreach($dhubs as $hub) {
@@ -675,27 +675,38 @@ function notifier_run($argv, $argc){
);
}
}
- $deliver[] = $hash;
- if(count($deliver) >= $deliveries_per_process) {
- proc_run('php','include/deliver.php',$deliver);
- $deliver = array();
- if($interval)
- @time_sleep_until(microtime(true) + (float) $interval);
+ $deliveries[] = $hash;
+ }
+
+ if($normal_mode) {
+ $x = q("select * from hook where hook = 'notifier_normal'");
+ if($x)
+ proc_run('php','deliver_hooks.php', $target_item['id']);
+ }
+
+ if($deliveries) {
+ $deliver = array();
+
+ foreach($deliveries as $d) {
+
+ $deliver[] = $d;
+
+ if(count($deliver) >= $deliveries_per_process) {
+ proc_run('php','include/deliver.php',$deliver);
+ $deliver = array();
+ if($interval)
+ @time_sleep_until(microtime(true) + (float) $interval);
+ }
}
}
// catch any stragglers
- if(count($deliver)) {
+ if($deliver)
proc_run('php','include/deliver.php',$deliver);
- }
logger('notifier: basic loop complete.', LOGGER_DEBUG);
-
- if($normal_mode)
- call_hooks('notifier_normal',$target_item);
-
call_hooks('notifier_end',$target_item);
diff --git a/mod/admin.php b/mod/admin.php
index 2b7bb007d..7d7c50dcf 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -254,6 +254,7 @@ function admin_page_site_post(&$a){
$proxy = ((x($_POST,'proxy')) ? notags(trim($_POST['proxy'])) : '');
$timeout = ((x($_POST,'timeout')) ? intval(trim($_POST['timeout'])) : 60);
$delivery_interval = ((x($_POST,'delivery_interval'))? intval(trim($_POST['delivery_interval'])) : 0);
+ $delivery_batch_count = ((x($_POST,'delivery_batch_count') && $_POST['delivery_batch_count'] > 0)? intval(trim($_POST['delivery_batch_count'])) : 1);
$poll_interval = ((x($_POST,'poll_interval')) ? intval(trim($_POST['poll_interval'])) : 0);
$maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50);
$feed_contacts = ((x($_POST,'feed_contacts')) ? intval($_POST['feed_contacts']) : 0);
@@ -261,6 +262,7 @@ function admin_page_site_post(&$a){
set_config('system', 'feed_contacts', $feed_contacts);
set_config('system', 'delivery_interval', $delivery_interval);
+ set_config('system', 'delivery_batch_count', $delivery_batch_count);
set_config('system', 'poll_interval', $poll_interval);
set_config('system', 'maxloadavg', $maxloadavg);
set_config('system', 'frontpage', $frontpage);
@@ -442,6 +444,7 @@ function admin_page_site(&$a) {
'$proxy' => array('proxy', t("Proxy URL"), get_config('system','proxy'), ""),
'$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
'$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
+ '$delivery_batch_count' => array('delivery_batch_count', t('Deliveries per process'),(x(get_config('system','delivery_batch_count'))?get_config('system','delivery_batch_count'):1), t("Number of deliveries to attempt in a single operating system process. Adjust if necessary to tune system performance. Recommend: 1-5.")),
'$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
'$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
'$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (matrix/network) content'), intval(get_config('system','default_expire_days')), t('0 for no expiration of imported content')),
diff --git a/mod/dreport.php b/mod/dreport.php
index a20e17372..31a6274c8 100644
--- a/mod/dreport.php
+++ b/mod/dreport.php
@@ -30,9 +30,48 @@ function dreport_content(&$a) {
$o .= '<h2>' . sprintf( t('Delivery report for %1$s'),substr($mid,0,32)) . '...' . '</h2>';
$o .= '<table>';
+ for($x = 0; $x < count($r); $x++ ) {
+ $r[$x]['name'] = escape_tags(substr($r[$x]['dreport_recip'],strpos($r[$x]['dreport_recip'],' ')));
+
+ switch($r[$x]['dreport_result']) {
+ case 'channel sync processed':
+ $r[$x]['gravity'] = 0;
+ $r[$x]['dreport_result'] = t('channel sync processed');
+ break;
+ case 'queued':
+ $r[$x]['gravity'] = 2;
+ $r[$x]['dreport_result'] = t('queued');
+ break;
+ case 'posted':
+ $r[$x]['gravity'] = 3;
+ $r[$x]['dreport_result'] = t('posted');
+ break;
+ case 'accepted for delivery':
+ $r[$x]['gravity'] = 4;
+ $r[$x]['dreport_result'] = t('accepted for delivery');
+ break;
+ case 'updated':
+ $r[$x]['gravity'] = 5;
+ $r[$x]['dreport_result'] = t('updated');
+ case 'update ignored':
+ $r[$x]['gravity'] = 6;
+ $r[$x]['dreport_result'] = t('update ignored');
+ break;
+ case 'permission denied':
+ $r[$x]['dreport_result'] = t('permission denied');
+ $r[$x]['gravity'] = 6;
+ break;
+ default:
+ $r[$x]['gravity'] = 1;
+ break;
+ }
+ }
+
+ usort($r,'dreport_gravity_sort');
+
+
foreach($r as $rr) {
- $name = escape_tags(substr($rr['dreport_recip'],strpos($rr['dreport_recip'],' ')));
- $o .= '<tr><td>' . $name . '</td><td>' . escape_tags($rr['dreport_result']) . '</td><td>' . escape_tags($rr['dreport_time']) . '</td></tr>';
+ $o .= '<tr><td width="40%">' . $rr['name'] . '</td><td width="20%">' . escape_tags($rr['dreport_result']) . '</td><td width="20%">' . escape_tags($rr['dreport_time']) . '</td></tr>';
}
$o .= '</table>';
@@ -40,4 +79,13 @@ function dreport_content(&$a) {
+}
+
+function dreport_gravity_sort($a,$b) {
+ if($a['gravity'] == $b['gravity']) {
+ if($a['name'] === $b['name'])
+ return strcmp($a['dreport_time'],$b['dreport_time']);
+ return strcmp($a['name'],$b['name']);
+ }
+ return (($a['gravity'] > $b['gravity']) ? 1 : (-1));
} \ No newline at end of file
diff --git a/mod/tasks.php b/mod/tasks.php
index ed267cc92..b1b81473b 100644
--- a/mod/tasks.php
+++ b/mod/tasks.php
@@ -73,7 +73,7 @@ function tasks_post(&$a) {
if(! $text)
return array('success' => false);
$event = array();
- $event['aid'] = $channel['channel_account_id'];
+ $event['account'] = $channel['channel_account_id'];
$event['uid'] = $channel['channel_id'];
$event['event_xchan'] = $channel['channel_hash'];
$event['type'] = 'task';
diff --git a/mod/uexport.php b/mod/uexport.php
index df66474f1..ee22383a3 100644
--- a/mod/uexport.php
+++ b/mod/uexport.php
@@ -41,13 +41,24 @@ function uexport_init(&$a) {
}
function uexport_content(&$a) {
+
+ $y = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
+
+ $yearurl = z_root() . '/uexport/' . $y;
+ $janurl = z_root() . '/uexport/' . $y . '/1';
+ $impurl = '/import_items';
$o = replace_macros(get_markup_template('uexport.tpl'), array(
'$title' => t('Export Channel'),
'$basictitle' => t('Export Channel'),
- '$basic' => t('Export your basic channel information to a small file. This acts as a backup of your connections, permissions, profile and basic data, which can be used to import your data to a new hub, but does not contain your content.'),
+ '$basic' => t('Export your basic channel information to a file. This acts as a backup of your connections, permissions, profile and basic data, which can be used to import your data to a new server hub, but does not contain your content.'),
'$fulltitle' => t('Export Content'),
- '$full' => t('Export your channel information and all the content to a JSON backup. This backs up all of your connections, permissions, profile data and the last year of posts. This file may be VERY large. Please be patient - it may take several minutes for this download to begin.'),
+ '$full' => t('Export your channel information and recent content to a JSON backup that can be restored or imported to another server hub. This backs up all of your connections, permissions, profile data and several months of posts. This file may be VERY large. Please be patient - it may take several minutes for this download to begin.'),
'$by_year' => t('Export your posts from a given year.'),
+
+ '$extra' => t('You may also export your posts and conversations for a particular year or month. Adjust the date in your browser location bar to select other dates. If the export fails (possibly due to memory exhaustion on your server hub), please try again selecting a more limited date range.'),
+ '$extra2' => sprintf( t('To select all posts for a given year, such as this year, visit <a href="%1$s">%2$s</a>'),$yearurl,$yearurl),
+ '$extra3' => sprintf( t('To select all posts for a given month, such as January of this year, visit <a href="%1$s">%2$s</a>'),$janurl,$janurl),
+ '$extra4' => sprintf( t('These content files may be imported or restored by visiting <a href="%1$s">%2$s</a> on any site containing your channel. For best results please import or restore these in date order (oldest first).'),$impurl,$impurl)
));
return $o;
diff --git a/view/tpl/admin_site.tpl b/view/tpl/admin_site.tpl
index e2ce3c552..26434b20a 100755
--- a/view/tpl/admin_site.tpl
+++ b/view/tpl/admin_site.tpl
@@ -78,6 +78,7 @@
{{include file="field_input.tpl" field=$proxyuser}}
{{include file="field_input.tpl" field=$timeout}}
{{include file="field_input.tpl" field=$delivery_interval}}
+ {{include file="field_input.tpl" field=$delivery_batch_count}}
{{include file="field_input.tpl" field=$poll_interval}}
{{include file="field_input.tpl" field=$maxloadavg}}
{{include file="field_input.tpl" field=$abandon_days}}
diff --git a/view/tpl/uexport.tpl b/view/tpl/uexport.tpl
index b9a1b9572..7eafd97a6 100644
--- a/view/tpl/uexport.tpl
+++ b/view/tpl/uexport.tpl
@@ -8,5 +8,12 @@
<p><b><a href="uexport/complete">{{$fulltitle}}</a></b></p>
<p>{{$full}}</p>
+
+ <p>{{$extra}}</p>
+ <p>{{$extra2}}</p>
+ <p>{{$extra3}}</p>
+
+ <p>{{$extra4}}</p>
+
</div>
</div>