aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-04-02 19:46:20 -0700
committerzotlabs <mike@macgirvin.com>2017-04-02 19:46:20 -0700
commit4a49643bcd125fde6c62c37a2d0a7902bbf502d7 (patch)
tree9df42323bf3dd2a61238d087a361c05dbaeb9599
parent29596d12e371cde577cdf741476698dc14ae3f14 (diff)
downloadvolse-hubzilla-4a49643bcd125fde6c62c37a2d0a7902bbf502d7.tar.gz
volse-hubzilla-4a49643bcd125fde6c62c37a2d0a7902bbf502d7.tar.bz2
volse-hubzilla-4a49643bcd125fde6c62c37a2d0a7902bbf502d7.zip
import_author_zot() - check for both hubloc and xchan entries. This should catch and repair entries which were subject to transient storage failures.
-rw-r--r--include/zot.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/include/zot.php b/include/zot.php
index b3999920f..266060839 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -3578,21 +3578,30 @@ function get_rpost_path($observer) {
function import_author_zot($x) {
+ // Check that we have both a hubloc and xchan record - as occasionally storage calls will fail and
+ // we may only end up with one; which results in posts with no author name or photo and are a bit
+ // of a hassle to repair. If either or both are missing, do a full discovery probe.
+
$hash = make_xchan_hash($x['guid'],$x['guid_sig']);
- $r = q("select hubloc_url from hubloc where hubloc_guid = '%s' and hubloc_guid_sig = '%s' and hubloc_primary = 1 limit 1",
+ $r1 = q("select hubloc_url from hubloc where hubloc_guid = '%s' and hubloc_guid_sig = '%s' and hubloc_primary = 1 limit 1",
dbesc($x['guid']),
dbesc($x['guid_sig'])
);
- if ($r) {
- logger('import_author_zot: in cache', LOGGER_DEBUG);
+ $r2 = q("select xchan_hash from xchan where xchan_guid = '%s' and xchan_guid_sig = '%s' limit 1",
+ dbesc($x['guid']),
+ dbesc($x['guid_sig'])
+ );
+
+ if($r1 && $r2) {
+ logger('in cache', LOGGER_DEBUG);
return $hash;
}
- logger('import_author_zot: entry not in cache - probing: ' . print_r($x,true), LOGGER_DEBUG);
+ logger('not in cache - probing: ' . print_r($x,true), LOGGER_DEBUG);
$them = array('hubloc_url' => $x['url'], 'xchan_guid' => $x['guid'], 'xchan_guid_sig' => $x['guid_sig']);
- if (zot_refresh($them))
+ if(zot_refresh($them))
return $hash;
return false;