aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Daemon/Queue.php4
-rw-r--r--Zotlabs/Lib/Libsync.php19
-rw-r--r--Zotlabs/Lib/Libzot.php114
3 files changed, 6 insertions, 131 deletions
diff --git a/Zotlabs/Daemon/Queue.php b/Zotlabs/Daemon/Queue.php
index 30f474a5c..6f7f8abac 100644
--- a/Zotlabs/Daemon/Queue.php
+++ b/Zotlabs/Daemon/Queue.php
@@ -22,7 +22,7 @@ class Queue {
if ($oldqItems) {
foreach ($oldqItems as $qItem) {
$h = parse_url($qItem['outq_posturl']);
- $site_url = $h['scheme'] . '://' . $h['host'] . (($h['port']) ? ':' . $h['port'] : '');
+ $site_url = $h['scheme'] . '://' . $h['host'] . ((!empty($h['port'])) ? ':' . $h['port'] : '');
q("update site set site_dead = 1 where site_dead = 0 and site_url = '%s' and site_update < %s - INTERVAL %s",
dbesc($site_url),
db_utcnow(),
@@ -44,7 +44,7 @@ class Queue {
dbesc($queue_id)
);
logger('queue deliver: ' . $qItems[0]['outq_hash'] . ' to ' . $qItems[0]['outq_posturl'], LOGGER_DEBUG);
- LibQueue\Queue::deliver($qItems[0]);
+ LibQueue::deliver($qItems[0]);
}
else {
$qItems = q("SELECT * FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s ",
diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php
index 19361c4ae..b0ce7cd12 100644
--- a/Zotlabs/Lib/Libsync.php
+++ b/Zotlabs/Lib/Libsync.php
@@ -766,11 +766,10 @@ class Libsync {
*
* @param array $sender
* @param array $arr
- * @param boolean $absolute (optional) default false
* @return array
*/
- static function sync_locations($sender, $arr, $absolute = false) {
+ static function sync_locations($sender, $arr) {
$ret = [];
$what = '';
@@ -787,9 +786,6 @@ class Libsync {
if (isset($arr['locations']) && $arr['locations']) {
- if ($absolute)
- Libzot::check_location_move($sender['hash'], $arr['locations']);
-
$xisting = q("select * from hubloc where hubloc_hash = '%s'",
dbesc($sender['hash'])
);
@@ -933,14 +929,7 @@ class Libsync {
$what .= 'primary_hub ';
$changed = true;
}
- elseif ($absolute) {
- // Absolute sync - make sure the current primary is correctly reflected in the xchan
- $pr = hubloc_change_primary($r[0]);
- if ($pr) {
- $what .= 'xchan_primary ';
- $changed = true;
- }
- }
+
if (intval($r[0]['hubloc_deleted']) && (!intval($location['deleted']))) {
q("update hubloc set hubloc_deleted = 0, hubloc_updated = '%s' where hubloc_id_url = '%s'",
dbesc(datetime_convert()),
@@ -1011,10 +1000,10 @@ class Libsync {
// get rid of any hubs we have for this channel which weren't reported.
- if ($absolute && $xisting) {
+ if ($xisting) {
foreach ($xisting as $x) {
if (!array_key_exists('updated', $x)) {
- logger('Deleting unreferenced hub location ' . $x['hubloc_addr']);
+ hz_syslog('Deleting unreferenced hub location ' . $x['hubloc_addr']);
q("update hubloc set hubloc_deleted = 1, hubloc_updated = '%s' where hubloc_id_url = '%s'",
dbesc(datetime_convert()),
dbesc($x['hubloc_id_url'])
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index c2787e03c..5610a21b2 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -2307,120 +2307,6 @@ class Libzot {
/**
- * @brief Processes delivery of profile.
- *
- * @param string $sender
- * @param array $arr
- * @param array $deliveries (unused)
- * @return void
- * @see import_directory_profile()
- *
- */
- static function process_profile_delivery($sender, $arr, $deliveries) {
-
- logger('process_profile_delivery', LOGGER_DEBUG);
-
- $r = q("select xchan_addr from xchan where xchan_hash = '%s' limit 1",
- dbesc($sender)
- );
- if ($r) {
- Libzotdir::import_directory_profile($sender, $arr, $r[0]['xchan_addr'], UPDATE_FLAGS_UPDATED, 0);
- }
- }
-
-
- /**
- * @brief
- *
- * @param string $sender
- * @param array $arr
- * @param array $deliveries (unused) deliveries is irrelevant
- * @return void
- */
- static function process_location_delivery($sender, $arr, $deliveries) {
-
- // deliveries is irrelevant
- logger('process_location_delivery', LOGGER_DEBUG);
-
- $r = q("select * from xchan where xchan_hash = '%s' limit 1",
- dbesc($sender)
- );
- if ($r) {
- $xchan = ['id' => $r[0]['xchan_guid'], 'id_sig' => $r[0]['xchan_guid_sig'],
- 'hash' => $r[0]['xchan_hash'], 'public_key' => $r[0]['xchan_pubkey']];
- }
- if (array_key_exists('locations', $arr) && $arr['locations']) {
- $x = Libsync::sync_locations($xchan, $arr, true);
- logger('results: ' . print_r($x, true), LOGGER_DEBUG);
- if ($x['changed']) {
- //$guid = random_string() . '@' . App::get_hostname();
- Libzotdir::update_modtime($sender, $r[0]['xchan_guid'], $arr['locations'][0]['address'], UPDATE_FLAGS_UPDATED);
- }
- }
- }
-
- /**
- * @brief Checks for a moved channel and sets the channel_moved flag.
- *
- * Currently the effect of this flag is to turn the channel into 'read-only' mode.
- * New content will not be processed (there was still an issue with blocking the
- * ability to post comments as of 10-Mar-2016).
- * We do not physically remove the channel at this time. The hub admin may choose
- * to do so, but is encouraged to allow a grace period of several days in case there
- * are any issues migrating content. This packet will generally be received by the
- * original site when the basic channel import has been processed.
- *
- * This will only be executed on the old location
- * if a new location is reported and there is only one location record.
- * The rest of the hubloc syncronisation will be handled within
- * sync_locations
- *
- * @param string $sender_hash A channel hash
- * @param array $locations
- * @return void
- */
- static function check_location_move($sender_hash, $locations) {
-
- if (!$locations)
- return;
-
- if (count($locations) != 1)
- return;
-
- $loc = $locations[0];
-
- $r = q("select * from channel where channel_hash = '%s' limit 1",
- dbesc($sender_hash)
- );
-
- if (!$r)
- return;
-
- if ($loc['url'] !== z_root()) {
- $x = q("update channel set channel_moved = '%s' where channel_hash = '%s' limit 1",
- dbesc($loc['url']),
- dbesc($sender_hash)
- );
-
- // federation plugins may wish to notify connections
- // of the move on singleton networks
-
- $arr = [
- 'channel' => $r[0],
- 'locations' => $locations
- ];
- /**
- * @hooks location_move
- * Called when a new location has been provided to a UNO channel (indicating a move rather than a clone).
- * * \e array \b channel
- * * \e array \b locations
- */
- call_hooks('location_move', $arr);
- }
- }
-
-
- /**
* @brief Returns an array with all known distinct hubs for this channel.
*
* @param array $channel an associative array which must contain