Migrate callers of Database::update() to UpdateQueryBuilder

Change-Id: I4094be019ea40bf3023e7d3fa7b25a58e7f12cb8
This commit is contained in:
Taavi Väänänen 2023-11-23 20:36:26 +02:00
parent 033f9192ee
commit b0f61d93ec
No known key found for this signature in database
GPG key ID: EF242F709F912FBE

View file

@ -154,9 +154,9 @@ class UpdateTables implements LoadExtensionSchemaUpdatesHook {
}
foreach ( $res as $row ) {
$db->update(
'oathauth_users',
[
$db->newUpdateQueryBuilder()
->update( 'oathauth_users' )
->set( [
'module' => 'totp',
'data' => FormatJson::encode( [
'keys' => [ [
@ -164,10 +164,10 @@ class UpdateTables implements LoadExtensionSchemaUpdatesHook {
'scratch_tokens' => $row->scratch_tokens
] ]
] )
],
[ 'id' => $row->id ],
__METHOD__
);
] )
->where( [ 'id' => $row->id ] )
->caller( __METHOD__ )
->execute();
}
}
}
@ -197,16 +197,17 @@ class UpdateTables implements LoadExtensionSchemaUpdatesHook {
if ( isset( $data['keys'] ) ) {
continue;
}
$db->update(
'oathauth_users',
[
$db->newUpdateQueryBuilder()
->update( 'oathauth_users' )
->set( [
'data' => FormatJson::encode( [
'keys' => [ $data ]
] )
],
[ 'id' => $row->id ],
__METHOD__
);
] )
->where( [ 'id' => $row->id ] )
->caller( __METHOD__ )
->execute();
}
return true;
@ -248,14 +249,12 @@ class UpdateTables implements LoadExtensionSchemaUpdatesHook {
continue;
}
$db->update(
'oathauth_users',
[
'data' => FormatJson::encode( $data )
],
[ 'id' => $row->id ],
__METHOD__
);
$db->newUpdateQueryBuilder()
->update( 'oathauth_users' )
->set( [ 'data' => FormatJson::encode( $data ) ] )
->where( [ 'id' => $row->id ] )
->caller( __METHOD__ )
->execute();
}
return true;