aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-02-19 09:26:39 +0000
committerMario <mario@mariovavti.com>2021-02-19 09:26:39 +0000
commita27572698888649f662e7465ad338cf9b6e9fcc2 (patch)
treef3abe5009df3d45713b8e48c98ad943ac85a1310
parent863d4d83a1708daa5cf9a1466681215f5b101b9d (diff)
downloadvolse-hubzilla-a27572698888649f662e7465ad338cf9b6e9fcc2.tar.gz
volse-hubzilla-a27572698888649f662e7465ad338cf9b6e9fcc2.tar.bz2
volse-hubzilla-a27572698888649f662e7465ad338cf9b6e9fcc2.zip
update site once a day
-rw-r--r--Zotlabs/Lib/Activity.php24
1 files changed, 21 insertions, 3 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index d4d1cd28c..d0799bb66 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -102,6 +102,17 @@ class Activity {
}
if ($x['success']) {
+ $m = parse_url($url);
+ if ($m) {
+ $site_url = unparse_url(['scheme' => $m['scheme'], 'host' => $m['host'], 'port' => $m['port'] ]);
+ q("UPDATE site SET site_update = '%s', site_dead = 0 WHERE site_url = '%s' AND site_update < %s - INTERVAL %s",
+ dbesc(datetime_convert()),
+ dbesc($site_url),
+ db_utcnow(),
+ db_quoteinterval('1 DAY')
+ );
+ }
+
$y = json_decode($x['body'], true);
logger('returned: ' . json_encode($y, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), LOGGER_DEBUG);
return json_decode($x['body'], true);
@@ -1350,7 +1361,7 @@ class Activity {
$abook_instance .= ',';
$abook_instance .= z_root();
- q("update abook set abook_instance = '%s', abook_not_here = 0
+ q("update abook set abook_instance = '%s', abook_not_here = 0
where abook_id = %d and abook_channel = %d",
dbesc($abook_instance),
intval($contact['abook_id']),
@@ -1630,7 +1641,7 @@ class Activity {
$m = parse_url($url);
if ($m) {
$hostname = $m['host'];
- $baseurl = $m['scheme'] . '://' . $m['host'] . (($m['port']) ? ':' . $m['port'] : '');
+ $site_url = $m['scheme'] . '://' . $m['host'] . (($m['port']) ? ':' . $m['port'] : '');
}
if (!$r) {
@@ -1640,7 +1651,7 @@ class Activity {
'hubloc_hash' => $url,
'hubloc_addr' => '',
'hubloc_network' => 'activitypub',
- 'hubloc_url' => $baseurl,
+ 'hubloc_url' => $site_url,
'hubloc_host' => $hostname,
'hubloc_callback' => $inbox,
'hubloc_updated' => datetime_convert(),
@@ -1650,6 +1661,13 @@ class Activity {
);
}
+ q("UPDATE site SET site_update = '%s', site_dead = 0 WHERE site_url = '%s' AND site_update < %s - INTERVAL %s",
+ dbesc(datetime_convert()),
+ dbesc($site_url),
+ db_utcnow(),
+ db_quoteinterval('1 DAY')
+ );
+
if (!$icon)
$icon = z_root() . '/' . get_default_profile_photo(300);