+ $old_fields = DBA::selectFirst('gcontact', $fieldnames, $condition);
+
+ // When the gcontact doesn't exist, the value "true" will trigger an insert.
+ // In difference to the public contacts we want to have every contact
+ // in the world in our global contacts.
+ if (!$old_fields) {
+ $old_fields = true;
+
+ // These values have to be set only on insert
+ $fields['photo'] = $data['photo'];
+ $fields['created'] = DateTimeFormat::utcNow();
+ }