some notifier optimisations. Also put a fixme on the invite total generations for new accounts, which is incorrect and now commented out.
This commit is contained in:
parent
9b4e6e1ec0
commit
b155f2260f
@ -68,6 +68,12 @@ require_once('include/html2plain.php');
|
|||||||
require_once('include/cli_startup.php');
|
require_once('include/cli_startup.php');
|
||||||
require_once('include/zot.php');
|
require_once('include/zot.php');
|
||||||
require_once('include/queue_fn.php');
|
require_once('include/queue_fn.php');
|
||||||
|
require_once('include/session.php');
|
||||||
|
require_once('include/datetime.php');
|
||||||
|
require_once('include/items.php');
|
||||||
|
require_once('include/bbcode.php');
|
||||||
|
require_once('include/identity.php');
|
||||||
|
require_once('include/Contact.php');
|
||||||
|
|
||||||
function notifier_run($argv, $argc){
|
function notifier_run($argv, $argc){
|
||||||
|
|
||||||
@ -75,15 +81,10 @@ function notifier_run($argv, $argc){
|
|||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
require_once("session.php");
|
|
||||||
require_once("datetime.php");
|
|
||||||
require_once('include/items.php');
|
|
||||||
require_once('include/bbcode.php');
|
|
||||||
|
|
||||||
if($argc < 3)
|
if($argc < 3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
logger('notifier: invoked: ' . print_r($argv,true), LOGGER_DEBUG);
|
logger('notifier: invoked: ' . print_r($argv,true), LOGGER_DEBUG);
|
||||||
|
|
||||||
$cmd = $argv[1];
|
$cmd = $argv[1];
|
||||||
@ -95,7 +96,6 @@ function notifier_run($argv, $argc){
|
|||||||
if(! $item_id)
|
if(! $item_id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
require_once('include/identity.php');
|
|
||||||
$sys = get_sys_channel();
|
$sys = get_sys_channel();
|
||||||
|
|
||||||
$deliveries = array();
|
$deliveries = array();
|
||||||
@ -112,22 +112,15 @@ function notifier_run($argv, $argc){
|
|||||||
|
|
||||||
if($cmd == 'permission_update' || $cmd == 'permission_create') {
|
if($cmd == 'permission_update' || $cmd == 'permission_create') {
|
||||||
// Get the recipient
|
// Get the recipient
|
||||||
$r = q("select abook.*, hubloc.* from abook
|
$r = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_self = 0",
|
||||||
left join hubloc on hubloc_hash = abook_xchan
|
intval($item_id)
|
||||||
where abook_id = %d and abook_self = 0
|
|
||||||
and not (hubloc_flags & %d) > 0 and not (hubloc_status & %d) > 0 limit 1",
|
|
||||||
intval($item_id),
|
|
||||||
intval(HUBLOC_FLAGS_DELETED),
|
|
||||||
intval(HUBLOC_OFFLINE)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
// Get the sender
|
// Get the sender
|
||||||
$s = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_id = %d limit 1",
|
$s = channelx_by_n($r[0]['abook_channel']);
|
||||||
intval($r[0]['abook_channel'])
|
|
||||||
);
|
|
||||||
if($s) {
|
if($s) {
|
||||||
$perm_update = array('sender' => $s[0], 'recipient' => $r[0], 'success' => false, 'deliveries' => '');
|
$perm_update = array('sender' => $s, 'recipient' => $r[0], 'success' => false, 'deliveries' => '');
|
||||||
|
|
||||||
if($cmd == 'permission_create')
|
if($cmd == 'permission_create')
|
||||||
call_hooks('permissions_create',$perm_update);
|
call_hooks('permissions_create',$perm_update);
|
||||||
@ -140,11 +133,10 @@ function notifier_run($argv, $argc){
|
|||||||
if(! $perm_update['success']) {
|
if(! $perm_update['success']) {
|
||||||
// send a refresh message to each hub they have registered here
|
// send a refresh message to each hub they have registered here
|
||||||
$h = q("select * from hubloc where hubloc_hash = '%s'
|
$h = q("select * from hubloc where hubloc_hash = '%s'
|
||||||
and not (hubloc_flags & %d) > 0 and not (hubloc_status & %d) > 0",
|
and hubloc_error = 0 and hubloc_deleted = 0",
|
||||||
dbesc($r[0]['hubloc_hash']),
|
dbesc($r[0]['hubloc_hash'])
|
||||||
intval(HUBLOC_FLAGS_DELETED),
|
|
||||||
intval(HUBLOC_OFFLINE)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if($h) {
|
if($h) {
|
||||||
foreach($h as $hh) {
|
foreach($h as $hh) {
|
||||||
if(in_array($hh['hubloc_url'],$dead_hubs)) {
|
if(in_array($hh['hubloc_url'],$dead_hubs)) {
|
||||||
@ -152,7 +144,7 @@ function notifier_run($argv, $argc){
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = zot_build_packet($s[0],'refresh',array(array(
|
$data = zot_build_packet($s,'refresh',array(array(
|
||||||
'guid' => $hh['hubloc_guid'],
|
'guid' => $hh['hubloc_guid'],
|
||||||
'guid_sig' => $hh['hubloc_guid_sig'],
|
'guid_sig' => $hh['hubloc_guid_sig'],
|
||||||
'url' => $hh['hubloc_url'])
|
'url' => $hh['hubloc_url'])
|
||||||
@ -161,8 +153,8 @@ function notifier_run($argv, $argc){
|
|||||||
$hash = random_string();
|
$hash = random_string();
|
||||||
queue_insert(array(
|
queue_insert(array(
|
||||||
'hash' => $hash,
|
'hash' => $hash,
|
||||||
'account_id' => $s[0]['channel_account_id'],
|
'account_id' => $s['channel_account_id'],
|
||||||
'channel_id' => $s[0]['channel_id'],
|
'channel_id' => $s['channel_id'],
|
||||||
'posturl' => $hh['hubloc_callback'],
|
'posturl' => $hh['hubloc_callback'],
|
||||||
'notify' => $data,
|
'notify' => $data,
|
||||||
));
|
));
|
||||||
|
@ -103,7 +103,9 @@ function register_post(&$a) {
|
|||||||
|
|
||||||
if($using_invites && $invite_code) {
|
if($using_invites && $invite_code) {
|
||||||
q("delete * from register where hash = '%s'", dbesc($invite_code));
|
q("delete * from register where hash = '%s'", dbesc($invite_code));
|
||||||
set_pconfig($result['account']['account_id'],'system','invites_remaining',$num_invites);
|
// @FIXME - this total needs to be stored by account, but pconfig operates on channels
|
||||||
|
// This also needs to be considered when using 'invites_remaining' in mod/invite.php
|
||||||
|
// set_pconfig($result['account']['account_id'],'system','invites_remaining',$num_invites);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($policy == REGISTER_OPEN ) {
|
if($policy == REGISTER_OPEN ) {
|
||||||
|
@ -1 +1 @@
|
|||||||
2015-12-15.1247
|
2015-12-16.1248
|
||||||
|
Reference in New Issue
Block a user