diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-09-10 19:18:12 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-09-10 19:18:12 -0700 |
commit | 4abfd4053a955a70c461290b7220145d2ce1a861 (patch) | |
tree | b56495087c6d2cd6f6813210911e8b6e0e34aad7 /include/import.php | |
parent | 00b480527a13d64299401292f2b6b1bb416f11c1 (diff) | |
download | volse-hubzilla-4abfd4053a955a70c461290b7220145d2ce1a861.tar.gz volse-hubzilla-4abfd4053a955a70c461290b7220145d2ce1a861.tar.bz2 volse-hubzilla-4abfd4053a955a70c461290b7220145d2ce1a861.zip |
sync likes
Diffstat (limited to 'include/import.php')
-rw-r--r-- | include/import.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/import.php b/include/import.php index 168446be9..ad8bcd84e 100644 --- a/include/import.php +++ b/include/import.php @@ -762,6 +762,43 @@ function sync_menus($channel,$menus) { +function import_likes($channel,$likes) { + if($channel && $likes) { + foreach($likes as $like) { + if($like['deleted']) { + q("delete from likes where liker = '%s' and likee = '%s' and verb = '%s' and target_type = '%s' and target_id = '%s'", + dbesc($like['liker']), + dbesc($like['likee']), + dbesc($like['verb']), + dbesc($like['target_type']), + dbesc($like['target_id']) + ); + continue; + } + + unset($like['id']); + unset($like['iid']); + $like['channel_id'] = $channel['channel_id']; + $r = q("select * from likes where liker = '%s' and likee = '%s' and verb = '%s' and target_type = '%s' and target_id = '%s' and i_mid = '%s'", + dbesc($like['liker']), + dbesc($like['likee']), + dbesc($like['verb']), + dbesc($like['target_type']), + dbesc($like['target_id']), + dbesc($like['i_mid']) + ); + if($r) + continue; + + dbesc_array($config); + $r = dbq("INSERT INTO likes (`" + . implode("`, `", array_keys($like)) + . "`) VALUES ('" + . implode("', '", array_values($like)) + . "')" ); + } + } +} |