aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-06-12 16:34:27 -0700
committerredmatrix <git@macgirvin.com>2016-06-12 16:35:17 -0700
commit7abfe716b47cd6f0171f0304ec07370c16dd595b (patch)
treef9c67eced7ab98ac65754d8cd1249534b9112518 /include
parent290a14d29e82fa33ec53d55a400b556e48e10b09 (diff)
downloadvolse-hubzilla-7abfe716b47cd6f0171f0304ec07370c16dd595b.tar.gz
volse-hubzilla-7abfe716b47cd6f0171f0304ec07370c16dd595b.tar.bz2
volse-hubzilla-7abfe716b47cd6f0171f0304ec07370c16dd595b.zip
DB schema issue with import
Diffstat (limited to 'include')
-rw-r--r--include/import.php38
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]);
+ }
+}