aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/dir_fns.php7
-rw-r--r--include/directory.php17
-rw-r--r--include/notifier.php2
-rw-r--r--include/zot.php13
4 files changed, 31 insertions, 8 deletions
diff --git a/include/dir_fns.php b/include/dir_fns.php
index adbcb6e3c..e234ae0fa 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -118,6 +118,7 @@ function update_directory_entry($ud) {
);
}
}
+
}
@@ -128,7 +129,7 @@ function syncdirs($uid) {
logger('syncdirs', LOGGER_DEBUG);
- $p = q("select channel.channel_hash, channel_timezone, profile.* from profile left join channel on channel_id = uid where uid = %d and is_default = 1",
+ $p = q("select channel.channel_hash, channel_address, channel_timezone, profile.* from profile left join channel on channel_id = uid where uid = %d and is_default = 1",
intval($uid)
);
@@ -199,6 +200,8 @@ function syncdirs($uid) {
}
}
- // TODO send refresh zots to downstream directory servers
+ $ud_hash = random_string();
+ update_modtime($ud_hash,$hash,$p[0]['channel_address'] . '@' . get_app()->get_hostname(),1);
+
}
diff --git a/include/directory.php b/include/directory.php
index c0a8928c0..16f819805 100644
--- a/include/directory.php
+++ b/include/directory.php
@@ -49,8 +49,25 @@ function directory_run($argv, $argc){
$packet = zot_build_packet($channel,'refresh');
$z = zot_zot($url,$packet);
+
// re-queue if unsuccessful
+ if(! $z['success']) {
+ $hash = random_string();
+ q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg )
+ values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )",
+ dbesc($hash),
+ intval($channel['channel_account_id']),
+ intval($channel['channel_id']),
+ dbesc($url),
+ intval(1),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ dbesc($packet),
+ dbesc('')
+ );
+ }
+
// Now update all the connections
proc_run('php','include/notifier.php','refresh_all',$channel['channel_id']);
diff --git a/include/notifier.php b/include/notifier.php
index 6ea2e71bb..1407be4b3 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -444,7 +444,7 @@ function notifier_run($argv, $argc){
$n = zot_build_packet($channel,$packet_type);
q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )",
dbesc($hash),
- intval($channel['channel_account']),
+ intval($channel['channel_account_id']),
intval($channel['channel_id']),
dbesc($hub['hubloc_callback']),
intval(1),
diff --git a/include/zot.php b/include/zot.php
index 0ee099ce5..91729f9de 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -604,11 +604,14 @@ function import_xchan($arr,$ud_flags = 1) {
);
if($r) {
logger('import_xchan: hub exists: ' . $location['url']);
- // update connection timestamp
- q("update hubloc set hubloc_connected = '%s' where hubloc_id = %d limit 1",
- dbesc(datetime_convert()),
- intval($r[0]['hubloc_id'])
- );
+ // update connection timestamp if this is the site we're talking to
+ if($location['url'] == $arr['site']['url']) {
+ q("update hubloc set hubloc_connected = '%s', hubloc_updated = '%s' where hubloc_id = %d limit 1",
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ intval($r[0]['hubloc_id'])
+ );
+ }
if((($r[0]['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) && (! $location['primary']))
|| ((! ($r[0]['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY)) && ($location['primary']))) {
$r = q("update hubloc set hubloc_flags = (hubloc_flags ^ %d), hubloc_updated = '%s' where hubloc_id = %d limit 1",