diff options
author | redmatrix <git@macgirvin.com> | 2016-06-12 16:34:27 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-06-12 16:34:27 -0700 |
commit | 81b3c5971119c5ceb2ae8cbfee71ad548a531140 (patch) | |
tree | c31f7490ce9956c9cedaaf8f6f082b1f0b237909 /include | |
parent | 410f5389ae90e1c219b097b051aaa9922e73efd5 (diff) | |
download | volse-hubzilla-81b3c5971119c5ceb2ae8cbfee71ad548a531140.tar.gz volse-hubzilla-81b3c5971119c5ceb2ae8cbfee71ad548a531140.tar.bz2 volse-hubzilla-81b3c5971119c5ceb2ae8cbfee71ad548a531140.zip |
DB schema issue with import
Diffstat (limited to 'include')
-rw-r--r-- | include/import.php | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/include/import.php b/include/import.php index 6fcb08416..be456bfa9 100644 --- a/include/import.php +++ b/include/import.php @@ -122,6 +122,11 @@ function import_profiles($channel,$profiles) { $profile['aid'] = get_account_id(); $profile['uid'] = $channel['channel_id']; + convert_oldfields($profile,'name','fullname'); + convert_oldfields($profile,'with','partner'); + convert_oldfields($profile,'work','employment'); + + // we are going to reset all profile photos to the original // somebody will have to fix this later and put all the applicable photos into the export @@ -644,6 +649,10 @@ function import_events($channel,$events) { unset($event['id']); $event['aid'] = $channel['channel_account_id']; $event['uid'] = $channel['channel_id']; + convert_oldfields($event,'start','dtstart'); + convert_oldfields($event,'finish','dtend'); + convert_oldfields($event,'type','etype'); + convert_oldfields($event,'ignore','dismissed'); dbesc_array($event); $r = dbq("INSERT INTO event (`" @@ -677,6 +686,12 @@ function sync_events($channel,$events) { $event['aid'] = $channel['channel_account_id']; $event['uid'] = $channel['channel_id']; + convert_oldfields($event,'start','dtstart'); + convert_oldfields($event,'finish','dtend'); + convert_oldfields($event,'type','etype'); + convert_oldfields($event,'ignore','dismissed'); + + $exists = false; $x = q("select * from event where event_hash = '%s' and uid = %d limit 1", @@ -974,10 +989,7 @@ function sync_files($channel,$files) { $attachment_stored = false; foreach($f['attach'] as $att) { - if(array_key_exists('data',$att)) { - $att['content'] = $att['data']; - unset($att['data']); - } + convert_oldfields($att,'data','content'); if($att['deleted']) { attach_delete($channel,$att['hash']); @@ -1130,14 +1142,10 @@ function sync_files($channel,$files) { $p['aid'] = $channel['channel_account_id']; $p['uid'] = $channel['channel_id']; - if(array_key_exists('data',$p)) { - $p['content'] = $p['data']; - unset($p['data']); - } - if(array_key_exists('scale',$p)) { - $p['imgscale'] = $p['scale']; - unset($p['scale']); - } + convert_oldfields($p,'data','content'); + convert_oldfields($p,'scale','imgscale'); + convert_oldfields($p,'size','filesize'); + convert_oldfields($p,'type','mimetype'); // if this is a profile photo, undo the profile photo bit // for any other photo which previously held it. @@ -1228,3 +1236,9 @@ function sync_files($channel,$files) { } +function convert_oldfields(&$arr,$old,$new) { + if(array_key_exists($old,$arr)) { + $arr[$new] = $arr[$old]; + unset($arr[$old]); + } +} |