Merge pull request #4977 from annando/dba-error
Avoid SQL error with wrong formatted datetime value
This commit is contained in:
commit
e5a6e7b449
|
@ -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]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue