diff options
author | Max Kostikov <max@kostikov.co> | 2020-12-19 22:02:51 +0100 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2020-12-19 22:02:51 +0100 |
commit | 116fc4e00df8f0a232289bc3fce37f8fc16f1c9d (patch) | |
tree | 0d1cc173d40f620626dff401333d7756975e8fc2 /include/import.php | |
parent | 600dcdfc583ab671fc61ff957ad7fd1a3a0c547d (diff) | |
parent | 57f6f54f29623972abc980b5e87c7933e32d1d3a (diff) | |
download | volse-hubzilla-116fc4e00df8f0a232289bc3fce37f8fc16f1c9d.tar.gz volse-hubzilla-116fc4e00df8f0a232289bc3fce37f8fc16f1c9d.tar.bz2 volse-hubzilla-116fc4e00df8f0a232289bc3fce37f8fc16f1c9d.zip |
Merge branch 'dev' into 'dev'
Dev sync
See merge request kostikov/core!4
Diffstat (limited to 'include/import.php')
-rw-r--r-- | include/import.php | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/include/import.php b/include/import.php index 8f7c28f93..cfbb8775d 100644 --- a/include/import.php +++ b/include/import.php @@ -1208,6 +1208,9 @@ function sync_files($channel, $files) { continue; } + $term = $att['term']; + unset($att['term']); + $attach_exists = false; $x = attach_by_hash($att['hash'],$channel['channel_hash']); logger('sync_files duplicate check: attach_exists=' . $attach_exists, LOGGER_DEBUG); @@ -1352,7 +1355,6 @@ function sync_files($channel, $files) { } $redirects = 0; - $headers = []; $headers['Accept'] = 'application/x-zot+json' ; $headers['Sigtoken'] = random_string(); @@ -1363,6 +1365,25 @@ function sync_files($channel, $files) { if($x['success']) { $attachment_stored = true; + + $a = q("SELECT id FROM attach WHERE hash = '%s' AND uid = %d LIMIT 1", + dbesc($att['hash']), + intval($channel['channel_id']) + ); + if($a) { + q("DELETE FROM term WHERE uid = %d AND oid = %d AND otype = %d", + intval($channel['channel_id']), + intval($a[0]['id']), + intval(TERM_OBJ_FILE) + ); + if($term) { + foreach($term as $t) { + if(array_key_exists('type',$t)) + $t['ttype'] = $t['type']; + store_item_tag($channel['channel_id'], $a[0]['id'], TERM_OBJ_FILE, $t['ttype'], escape_tags($t['term']), escape_tags($t['url'])); + } + } + } } continue; } |