Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/storage/PhabricatorRepository.php
Show First 20 Lines • Show All 1,645 Lines • ▼ Show 20 Lines | if ($status_code === null) { | ||||
$conn_w, | $conn_w, | ||||
'DELETE FROM %T WHERE repositoryID = %d AND statusType = %s', | 'DELETE FROM %T WHERE repositoryID = %d AND statusType = %s', | ||||
$table_name, | $table_name, | ||||
$this->getID(), | $this->getID(), | ||||
$status_type); | $status_type); | ||||
} else { | } else { | ||||
// If the existing message has the same code (e.g., we just hit an | // If the existing message has the same code (e.g., we just hit an | ||||
// error and also previously hit an error) we increment the message | // error and also previously hit an error) we increment the message | ||||
// count by 1. This allows us to determine how many times in a row | // count. This allows us to determine how many times in a row we've | ||||
// we've run into an error. | // run into an error. | ||||
// NOTE: The assignments in "ON DUPLICATE KEY UPDATE" are evaluated | |||||
// in order, so the "messageCount" assignment must occur before the | |||||
// "statusCode" assignment. See T11705. | |||||
queryfx( | queryfx( | ||||
$conn_w, | $conn_w, | ||||
'INSERT INTO %T | 'INSERT INTO %T | ||||
(repositoryID, statusType, statusCode, parameters, epoch, | (repositoryID, statusType, statusCode, parameters, epoch, | ||||
messageCount) | messageCount) | ||||
VALUES (%d, %s, %s, %s, %d, %d) | VALUES (%d, %s, %s, %s, %d, %d) | ||||
ON DUPLICATE KEY UPDATE | ON DUPLICATE KEY UPDATE | ||||
statusCode = VALUES(statusCode), | |||||
parameters = VALUES(parameters), | |||||
epoch = VALUES(epoch), | |||||
messageCount = | messageCount = | ||||
IF( | IF( | ||||
statusCode = VALUES(statusCode), | statusCode = VALUES(statusCode), | ||||
messageCount + 1, | messageCount + VALUES(messageCount), | ||||
VALUES(messageCount))', | VALUES(messageCount)), | ||||
statusCode = VALUES(statusCode), | |||||
parameters = VALUES(parameters), | |||||
epoch = VALUES(epoch)', | |||||
$table_name, | $table_name, | ||||
$this->getID(), | $this->getID(), | ||||
$status_type, | $status_type, | ||||
$status_code, | $status_code, | ||||
json_encode($parameters), | json_encode($parameters), | ||||
time(), | time(), | ||||
1); | 1); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 792 Lines • Show Last 20 Lines |