mirror of
https://github.com/friendica/friendica
synced 2025-04-30 07:04:23 +02:00
The inbox-status can now be archived for a whole server
This commit is contained in:
parent
7942881f7e
commit
e21db0fe6d
7 changed files with 105 additions and 15 deletions
|
@ -332,15 +332,19 @@ class HTTPSignature
|
|||
* @param string $url The URL of the inbox
|
||||
* @param boolean $success Transmission status
|
||||
* @param boolean $shared The inbox is a shared inbox
|
||||
* @param int $gsid Server ID
|
||||
* @throws \Exception
|
||||
*/
|
||||
static public function setInboxStatus(string $url, bool $success, bool $shared = false)
|
||||
static public function setInboxStatus(string $url, bool $success, bool $shared = false, int $gsid = null)
|
||||
{
|
||||
$now = DateTimeFormat::utcNow();
|
||||
|
||||
$status = DBA::selectFirst('inbox-status', [], ['url' => $url]);
|
||||
if (!DBA::isResult($status)) {
|
||||
$insertFields = ['url' => $url, 'uri-id' => ItemURI::getIdByURI($url), 'created' => $now, 'shared' => $shared];
|
||||
if (!empty($gsid)) {
|
||||
$insertFields['gsid'] = $gsid;
|
||||
}
|
||||
if (!DBA::insert('inbox-status', $insertFields, Database::INSERT_IGNORE)) {
|
||||
Logger::warning('Unable to insert inbox-status row', $insertFields);
|
||||
return;
|
||||
|
@ -355,6 +359,10 @@ class HTTPSignature
|
|||
$fields = ['failure' => $now];
|
||||
}
|
||||
|
||||
if (!empty($gsid)) {
|
||||
$fields['gsid'] = $gsid;
|
||||
}
|
||||
|
||||
if ($status['failure'] > DBA::NULL_DATETIME) {
|
||||
$new_previous_stamp = strtotime($status['failure']);
|
||||
$old_previous_stamp = strtotime($status['previous']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue