backend support for 'x' deliveries per process - x is configurable, more importantly any search starting with # is automatically a tag search. TODO: Need to extend this to people searches starting with @
This commit is contained in:
parent
a49bd0a686
commit
513ef2410d
|
@ -38,7 +38,10 @@ function delivery_run($argv, $argc){
|
||||||
|
|
||||||
$cmd = $argv[1];
|
$cmd = $argv[1];
|
||||||
$item_id = intval($argv[2]);
|
$item_id = intval($argv[2]);
|
||||||
$contact_id = intval($argv[3]);
|
|
||||||
|
for($x = 3; $x < $argc; $x ++) {
|
||||||
|
|
||||||
|
$contact_id = intval($argv[x]);
|
||||||
|
|
||||||
// Some other process may have delivered this item already.
|
// Some other process may have delivered this item already.
|
||||||
|
|
||||||
|
@ -48,7 +51,7 @@ function delivery_run($argv, $argc){
|
||||||
dbesc($contact_id)
|
dbesc($contact_id)
|
||||||
);
|
);
|
||||||
if(! count($r)) {
|
if(! count($r)) {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$maxsysload = intval(get_config('system','maxloadavg'));
|
$maxsysload = intval(get_config('system','maxloadavg'));
|
||||||
|
@ -71,7 +74,7 @@ function delivery_run($argv, $argc){
|
||||||
);
|
);
|
||||||
|
|
||||||
if((! $item_id) || (! $contact_id))
|
if((! $item_id) || (! $contact_id))
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
$expire = false;
|
$expire = false;
|
||||||
$top_level = false;
|
$top_level = false;
|
||||||
|
@ -92,7 +95,7 @@ function delivery_run($argv, $argc){
|
||||||
$uid = $item_id;
|
$uid = $item_id;
|
||||||
$item_id = 0;
|
$item_id = 0;
|
||||||
if(! count($items))
|
if(! count($items))
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -102,7 +105,7 @@ function delivery_run($argv, $argc){
|
||||||
);
|
);
|
||||||
|
|
||||||
if((! count($r)) || (! intval($r[0]['parent']))) {
|
if((! count($r)) || (! intval($r[0]['parent']))) {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$target_item = $r[0];
|
$target_item = $r[0];
|
||||||
|
@ -111,7 +114,7 @@ function delivery_run($argv, $argc){
|
||||||
$updated = $r[0]['edited'];
|
$updated = $r[0]['edited'];
|
||||||
|
|
||||||
if(! $parent_id)
|
if(! $parent_id)
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
$items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
|
$items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
|
||||||
|
@ -120,7 +123,7 @@ function delivery_run($argv, $argc){
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! count($items)) {
|
if(! count($items)) {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$icontacts = null;
|
$icontacts = null;
|
||||||
|
@ -135,7 +138,7 @@ function delivery_run($argv, $argc){
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if( ! ($icontacts && count($icontacts)))
|
if( ! ($icontacts && count($icontacts)))
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
// avoid race condition with deleting entries
|
// avoid race condition with deleting entries
|
||||||
|
|
||||||
|
@ -159,7 +162,7 @@ function delivery_run($argv, $argc){
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! count($r))
|
if(! count($r))
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
$owner = $r[0];
|
$owner = $r[0];
|
||||||
|
|
||||||
|
@ -209,7 +212,7 @@ function delivery_run($argv, $argc){
|
||||||
logger('relay denied for delivery agent.');
|
logger('relay denied for delivery agent.');
|
||||||
|
|
||||||
/* no relay allowed for direct contact delivery */
|
/* no relay allowed for direct contact delivery */
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((strlen($parent['allow_cid']))
|
if((strlen($parent['allow_cid']))
|
||||||
|
@ -233,7 +236,7 @@ function delivery_run($argv, $argc){
|
||||||
require_once('include/salmon.php');
|
require_once('include/salmon.php');
|
||||||
|
|
||||||
if($contact['self'])
|
if($contact['self'])
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
$deliver_status = 0;
|
$deliver_status = 0;
|
||||||
|
|
||||||
|
@ -537,6 +540,7 @@ function delivery_run($argv, $argc){
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -478,6 +478,12 @@ function notifier_run($argv, $argc){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$deliveries_per_process = intval(get_config('system','delivery_batch_count'));
|
||||||
|
if($deliveries_per_process <= 0)
|
||||||
|
$deliveries_per_process = 1;
|
||||||
|
|
||||||
|
$this_batch = array();
|
||||||
|
|
||||||
foreach($r as $contact) {
|
foreach($r as $contact) {
|
||||||
if($contact['self'])
|
if($contact['self'])
|
||||||
continue;
|
continue;
|
||||||
|
@ -486,6 +492,7 @@ function notifier_run($argv, $argc){
|
||||||
// we will deliver single recipient types of message and email receipients here.
|
// we will deliver single recipient types of message and email receipients here.
|
||||||
|
|
||||||
if((! $mail) && (! $fsuggest) && (! $followup)) {
|
if((! $mail) && (! $fsuggest) && (! $followup)) {
|
||||||
|
// deliveries per process not yet implemented, 1 delivery per process.
|
||||||
proc_run('php','include/delivery.php',$cmd,$item_id,$contact['id']);
|
proc_run('php','include/delivery.php',$cmd,$item_id,$contact['id']);
|
||||||
if($interval)
|
if($interval)
|
||||||
@time_sleep_until(microtime(true) + (float) $interval);
|
@time_sleep_until(microtime(true) + (float) $interval);
|
||||||
|
|
|
@ -96,6 +96,12 @@ function search_content(&$a) {
|
||||||
|
|
||||||
$o .= search($search,'search-box','/search',((local_user()) ? true : false));
|
$o .= search($search,'search-box','/search',((local_user()) ? true : false));
|
||||||
|
|
||||||
|
|
||||||
|
if(strpos($search,'#') === 0) {
|
||||||
|
$tag = true;
|
||||||
|
$search = substr($search,1);
|
||||||
|
}
|
||||||
|
|
||||||
if(! $search)
|
if(! $search)
|
||||||
return $o;
|
return $o;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue