Merge pull request #4977 from annando/dba-error

Avoid SQL error with wrong formatted datetime value
This commit is contained in:
Hypolite Petovan 2018-05-03 17:03:30 -04:00 committed by GitHub
commit e5a6e7b449
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 168 additions and 168 deletions

View file

@ -88,11 +88,11 @@ class PostUpdate
$r = q($query1.$query2.$query3." ORDER BY `item`.`id` LIMIT 1000,1", $r = q($query1.$query2.$query3." ORDER BY `item`.`id` LIMIT 1000,1",
intval($start_id), intval($end_id), intval($start_id), intval($end_id),
dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS)); dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS));
if ($r) if ($r) {
$pos_id = $r[0]["id"]; $pos_id = $r[0]["id"];
else } else {
$pos_id = $end_id; $pos_id = $end_id;
}
logger("Progress: Start: ".$start_id." position: ".$pos_id." end: ".$end_id, LOGGER_DEBUG); logger("Progress: Start: ".$start_id." position: ".$pos_id." end: ".$end_id, LOGGER_DEBUG);
q("UPDATE `item` ".$query2." SET `item`.`global` = 1 ".$query3, q("UPDATE `item` ".$query2." SET `item`.`global` = 1 ".$query3,
@ -165,12 +165,12 @@ class PostUpdate
$author_id = Contact::getIdForURL($item["author-link"]); $author_id = Contact::getIdForURL($item["author-link"]);
$owner_id = Contact::getIdForURL($item["owner-link"]); $owner_id = Contact::getIdForURL($item["owner-link"]);
if ($author_id == 0) if ($author_id == 0) {
$author_id = -1; $author_id = -1;
}
if ($owner_id == 0) if ($owner_id == 0) {
$owner_id = -1; $owner_id = -1;
}
dba::update('item', ['author-id' => $author_id, 'owner-id' => $owner_id], ['uid' => $item['uid'], 'author-link' => $item['author-link'], 'owner-link' => $item['owner-link'], 'author-id' => 0, 'owner-id' => 0]); dba::update('item', ['author-id' => $author_id, 'owner-id' => $owner_id], ['uid' => $item['uid'], 'author-link' => $item['author-link'], 'owner-link' => $item['owner-link'], 'author-id' => 0, 'owner-id' => 0]);
} }

View file

@ -78,7 +78,7 @@ class OnePoll
$last_updated = $contact['last-item']; $last_updated = $contact['last-item'];
} }
$fields = ['last-item' => $last_updated, 'last-update' => $updated, 'success_update' => $updated]; $fields = ['last-item' => DateTimeFormat::utc($last_updated), 'last-update' => $updated, 'success_update' => $updated];
self::updateContact($contact, $fields); self::updateContact($contact, $fields);
Contact::unmarkForArchival($contact); Contact::unmarkForArchival($contact);
} else { } else {