Call IDatabase::timestamp before inserting rows

This is needed for proper cross-RDBMS support

Bug: T244898
Change-Id: I46206e0b3a687dff3168a81cf0020e669133e876
This commit is contained in:
Umherirrender 2022-01-05 19:56:37 +01:00
parent 6af1473ca6
commit 4eb8fa23e4
2 changed files with 12 additions and 6 deletions

View file

@ -117,13 +117,17 @@ class EchoUnreadWikis {
if ( $alertCount || $msgCount ) {
$values = [
'euw_alerts' => $alertCount,
'euw_alerts_ts' => $alertTime
? $alertTime->getTimestamp( TS_MW )
: static::DEFAULT_TS,
'euw_alerts_ts' => $dbw->timestamp(
$alertTime
? $alertTime->getTimestamp( TS_MW )
: static::DEFAULT_TS
),
'euw_messages' => $msgCount,
'euw_messages_ts' => $msgTime
? $msgTime->getTimestamp( TS_MW )
: static::DEFAULT_TS,
'euw_messages_ts' => $dbw->timestamp(
$msgTime
? $msgTime->getTimestamp( TS_MW )
: static::DEFAULT_TS
),
];
// when there is unread alert(s) and/or message(s), upsert the row

View file

@ -25,6 +25,8 @@ class EchoNotificationMapper extends EchoAbstractMapper {
static function ( IDatabase $dbw, $fname ) use ( $row, $listeners ) {
$row['notification_timestamp'] =
$dbw->timestamp( $row['notification_timestamp'] );
$row['notification_read_timestamp'] =
$dbw->timestampOrNull( $row['notification_read_timestamp'] );
$dbw->insert( 'echo_notification', $row, $fname );
foreach ( $listeners as $listener ) {
$dbw->onTransactionCommitOrIdle( $listener, $fname );