aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-05-01 16:15:59 -0700
committerzotlabs <mike@macgirvin.com>2018-05-01 16:15:59 -0700
commit08bcd29eeee1166d62791b04c7de4a6c1a4e7456 (patch)
treec1af39996422893b8796f1da962f94f70d945f34 /Zotlabs/Module
parent32423a7706c45d0d7187444f50eac33ca4fdfaa0 (diff)
downloadvolse-hubzilla-08bcd29eeee1166d62791b04c7de4a6c1a4e7456.tar.gz
volse-hubzilla-08bcd29eeee1166d62791b04c7de4a6c1a4e7456.tar.bz2
volse-hubzilla-08bcd29eeee1166d62791b04c7de4a6c1a4e7456.zip
hubzilla issue #1149, don't duplicate addressbook entries on repeated channel imports
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Import.php24
1 files changed, 20 insertions, 4 deletions
diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php
index 81c405f00..58f0c60d5 100644
--- a/Zotlabs/Module/Import.php
+++ b/Zotlabs/Module/Import.php
@@ -363,11 +363,27 @@ class Import extends \Zotlabs\Web\Controller {
continue;
}
- abook_store_lowlevel($abook);
+ $r = q("select abook_id from abook where abook_xchan = '%s' and abook_channel = %d limit 1",
+ dbesc($abook['abook_xchan']),
+ intval($channel['channel_id'])
+ );
+ if($r) {
+ foreach($abook as $k => $v) {
+ $r = q("UPDATE abook SET " . TQUOT . "%s" . TQUOT . " = '%s' WHERE abook_xchan = '%s' AND abook_channel = %d",
+ dbesc($k),
+ dbesc($v),
+ dbesc($abook['abook_xchan']),
+ intval($channel['channel_id'])
+ );
+ }
+ }
+ else {
+ abook_store_lowlevel($abook);
- $friends ++;
- if(intval($abook['abook_feed']))
- $feeds ++;
+ $friends ++;
+ if(intval($abook['abook_feed']))
+ $feeds ++;
+ }
translate_abook_perms_inbound($channel,$abook_copy);