Fixup incrementQueue

This commit is contained in:
Philipp 2023-05-14 20:52:07 +02:00
parent 6d2ae6a9e3
commit c21e6ab952
No known key found for this signature in database
GPG Key ID: 24A7501396EB5432
2 changed files with 20 additions and 5 deletions

View File

@ -86,19 +86,19 @@ class DeliveryData
switch ($protocol) { switch ($protocol) {
case self::ACTIVITYPUB: case self::ACTIVITYPUB:
$increments[] = ["`activitypub` = `activitypub` + 1"]; $increments[] = "`activitypub` = `activitypub` + 1";
break; break;
case self::DFRN: case self::DFRN:
$increments[] = ["`dfrn` = `dfrn` + 1"]; $increments[] = "`dfrn` = `dfrn` + 1";
break; break;
case self::LEGACY_DFRN: case self::LEGACY_DFRN:
$increments[] = ["`legacy_dfrn` = `legacy_dfrn` + 1"]; $increments[] = "`legacy_dfrn` = `legacy_dfrn` + 1";
break; break;
case self::DIASPORA: case self::DIASPORA:
$increments[] = ["`diaspora` = `diaspora` + 1"]; $increments[] = "`diaspora` = `diaspora` + 1";
break; break;
case self::OSTATUS: case self::OSTATUS:
$increments[] = ["`ostatus` = `ostatus` + 1"]; $increments[] = "`ostatus` = `ostatus` + 1";
break; break;
} }

View File

@ -85,4 +85,19 @@ class DatabaseTest extends FixtureTest
])); ]));
self::assertEquals(1, $db->selectFirst('gserver', ['registered-users'], ['nurl' => 'http://friendica.local'])['registered-users']); self::assertEquals(1, $db->selectFirst('gserver', ['registered-users'], ['nurl' => 'http://friendica.local'])['registered-users']);
} }
public function testUpdateWithArray()
{
$db = $this->getDbInstance();
self::assertTrue($db->update('gserver', ['active-week-users' => 0, 'registered-users' => 0], ['nurl' => 'http://friendica.local']));
$fields = ["`registered-users` = `registered-users` + 1"];
$fields[] = "`active-week-users` = `active-week-users` + 2";
self::assertTrue($db->update('gserver', $fields, ['nurl' => 'http://friendica.local']));
self::assertEquals(2, $db->selectFirst('gserver', ['active-week-users'], ['nurl' => 'http://friendica.local'])['active-week-users']);
self::assertEquals(1, $db->selectFirst('gserver', ['registered-users'], ['nurl' => 'http://friendica.local'])['registered-users']);
}
} }