From 43c2b22fca908cb5c7bb740855cbd9d04e085d62 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 17 May 2016 19:49:21 -0700 Subject: cli utilities - argc and argv reversed. Not functionally incorrect since it was consistent but aesthetically incorrect. --- include/ratenotif.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/ratenotif.php') diff --git a/include/ratenotif.php b/include/ratenotif.php index 2c636c710..3a5e515ae 100644 --- a/include/ratenotif.php +++ b/include/ratenotif.php @@ -5,7 +5,7 @@ require_once('include/zot.php'); require_once('include/queue_fn.php'); -function ratenotif_run($argv, $argc){ +function ratenotif_run($argc,$argv){ cli_startup(); @@ -114,6 +114,6 @@ function ratenotif_run($argv, $argc){ } if (array_search(__file__,get_included_files())===0){ - ratenotif_run($argv,$argc); + ratenotif_run($argc,$argv); killme(); } -- cgit v1.2.3 From a2cec8899ad191b47d116f4ea124be6bd5b05472 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 19 May 2016 22:26:37 -0700 Subject: daemon conversion continued... --- include/ratenotif.php | 119 -------------------------------------------------- 1 file changed, 119 deletions(-) delete mode 100644 include/ratenotif.php (limited to 'include/ratenotif.php') diff --git a/include/ratenotif.php b/include/ratenotif.php deleted file mode 100644 index 3a5e515ae..000000000 --- a/include/ratenotif.php +++ /dev/null @@ -1,119 +0,0 @@ - 'rating', - 'encoding' => 'zot', - 'target' => $r[0]['xlink_link'], - 'rating' => intval($r[0]['xlink_rating']), - 'rating_text' => $r[0]['xlink_rating_text'], - 'signature' => $r[0]['xlink_sig'], - 'edited' => $r[0]['xlink_updated'] - ); - } - - $channel = channelx_by_hash($r[0]['xlink_xchan']); - if(! $channel) { - logger('no channel'); - return; - } - - - $primary = get_directory_primary(); - - if(! $primary) - return; - - - $interval = ((get_config('system','delivery_interval') !== false) - ? intval(get_config('system','delivery_interval')) : 2 ); - - $deliveries_per_process = intval(get_config('system','delivery_batch_count')); - - if($deliveries_per_process <= 0) - $deliveries_per_process = 1; - - $deliver = array(); - - $x = z_fetch_url($primary . '/regdir'); - if($x['success']) { - $j = json_decode($x['body'],true); - if($j && $j['success'] && is_array($j['directories'])) { - - foreach($j['directories'] as $h) { - if($h == z_root()) - continue; - - $hash = random_string(); - $n = zot_build_packet($channel,'notify',null,null,$hash); - - queue_insert(array( - 'hash' => $hash, - 'account_id' => $channel['channel_account_id'], - 'channel_id' => $channel['channel_id'], - 'posturl' => $h . '/post', - 'notify' => $n, - 'msg' => json_encode($encoded_item) - )); - - $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); - } - } - - // catch any stragglers - - if(count($deliver)) { - proc_run('php','include/deliver.php',$deliver); - } - } - } - - logger('ratenotif: complete.'); - return; - -} - -if (array_search(__file__,get_included_files())===0){ - ratenotif_run($argc,$argv); - killme(); -} -- cgit v1.2.3