aboutsummaryrefslogtreecommitdiffstats
path: root/include/dir_fns.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-06-28 16:21:54 -0700
committerzotlabs <mike@macgirvin.com>2019-06-28 16:21:54 -0700
commit98100520eba567138799997506027daa10063f55 (patch)
tree0e4d20c7f7f0fcb87bf94cd7c7e7c4167245a53a /include/dir_fns.php
parent96a99935ef4f2da899275166b127537287966dac (diff)
downloadvolse-hubzilla-98100520eba567138799997506027daa10063f55.tar.gz
volse-hubzilla-98100520eba567138799997506027daa10063f55.tar.bz2
volse-hubzilla-98100520eba567138799997506027daa10063f55.zip
begin directory migration to zot6, see the code comments
Diffstat (limited to 'include/dir_fns.php')
-rw-r--r--include/dir_fns.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/dir_fns.php b/include/dir_fns.php
index 2bd1228ec..0b404925d 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -329,6 +329,32 @@ function update_directory_entry($ud) {
if ($ud['ud_addr'] && (! ($ud['ud_flags'] & UPDATE_FLAGS_DELETED))) {
$success = false;
+
+ // directory migration phase 1 (Macgirvin - 29-JUNE-2019)
+ // fetch zot6 info (if available) as well as historical zot info (if available)
+ // Once this has been running for > 1 month on the primary directory we can deprecate the historical info and
+ // modify the directory search to only return zot6 entries, and also modify this function
+ // to *only* fetch the zot6 entries.
+ // Otherwise we'll be showing duplicates or have a mostly empty directory for a good chunk of
+ // the transition period. Directory server load will likely increase "moderately" during this transition.
+ // The one month counter begins when the primary directory has upgraded to a release which uses this code.
+ // Hubzilla channels running traditional zot which have not upgraded can or will be dropped from the directory or
+ // "not found" at the end of the transition period as the directory will only serve zot6 entries at that time.
+
+ $uri = \Zotlabs\Lib\Webfinger::zot_url($ud['ud_addr']);
+ if($uri) {
+ $record = \Zotlabs\Lib\Zotfinger::exec($url,$channel);
+
+ // Check the HTTP signature
+
+ $hsig = $record['signature'];
+ if($hsig && $hsig['signer'] === $url && $hsig['header_valid'] === true && $hsig['content_valid'] === true) {
+ $x = \Zotlabs\Zot\Libzot::import_xchan($record['data'], 0, $ud);
+ if($x['success']) {
+ $success = true;
+ }
+ }
+ }
$x = zot_finger($ud['ud_addr'], '');
if ($x['success']) {
$j = json_decode($x['body'], true);