1
0
Fork 0

Avoid storing "null" values

This commit is contained in:
Michael 2018-03-17 13:09:21 +00:00
parent e2f5350e61
commit 8700d2a8ad
2 changed files with 8 additions and 7 deletions

View file

@ -2079,8 +2079,8 @@ class DFRN
return false;
}
$fields = ['title' => $item["title"], 'body' => $item["body"],
'tag' => $item["tag"], 'changed' => DateTimeFormat::utcNow(),
$fields = ['title' => defaults($item["title"], ''), 'body' => defaults($item["body"], ''),
'tag' => defaults($item["tag"], ''), 'changed' => DateTimeFormat::utcNow(),
'edited' => DateTimeFormat::utc($item["edited"])];
$condition = ["`uri` = ? AND `uid` IN (0, ?)", $item["uri"], $importer["importer_uid"]];

View file

@ -1355,11 +1355,12 @@ class PortableContact
$info = strip_tags($info);
$platform = strip_tags($platform);
$fields = ['url' => $server_url, 'version' => $version,
'site_name' => $site_name, 'info' => $info, 'register_policy' => $register_policy,
'poco' => $poco, 'noscrape' => $noscrape, 'network' => $network,
'platform' => $platform, 'registered-users' => $registered_users,
'last_contact' => $last_contact, 'last_failure' => $last_failure];
$fields = ['url' => $server_url, 'version' => defaults($version, ''),
'site_name' => defaults($site_name, ''), 'info' => defaults($info, ''),
'register_policy' => defaults($register_policy, 0), 'poco' => defaults($poco, ''),
'noscrape' => defaults($noscrape, ''), 'network' => defaults($network, ''),
'platform' => defaults($platform, ''), 'registered-users' => defaults($registered_users, 0),
'last_contact' => defaults($last_contact, ''), 'last_failure' => defaults($last_failure, '')];
if ($found) {
dba::update('gserver', $fields, ['nurl' => normalise_link($server_url)]);