[maintenance] Wikimedia\Rdbms\Platform\SQLPlatform::isWriteQuery fallback to regex #5568
Labels
bug
Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error
Setup
Issue
This is a maintenance task about the warning
Wikimedia\Rdbms\Platform\SQLPlatform::isWriteQuery fallback to regex
.This warning is triggered in high volumes since MediaWiki requires the query type (essentially if it is a write or read, but there are subtypes) since 1.40 (this Gerrit change), after these constants were introduced in MediaWiki 1.35 (this commit).
The query types are the constants
ISQLPlatform::QUERY_CHANGE_*
(see this link):QUERY_CHANGE_NONE
(subtype of read) for Data Query Language (SELECT except when there is the option "FOR UPDATE", …)QUERY_CHANGE_TRX
(subtype of read) for Transaction Control Language (BEGIN, COMMIT, USE, SET, …) (NB: COMMIT is considered as read as explained here)QUERY_CHANGE_LOCKS
(subtype of read) for advisory locksQUERY_CHANGE_ROWS
(subtype of write) for Data Manipulation Language (UPDATE, DELETE, LOCK, …)QUERY_CHANGE_SCHEMA
(subtype of write) for Data Definition Language (CREATE, DROP, ALTER, …)To avoid this warning, the calls to
Wikimedia\Rdbms\Database::query()
must have a third parameter with the query type from the constants above. Obviously, calls toDatabase::select()
,Database::delete()
are automatically classified.Example of stack trace (but there are many different ones):
The text was updated successfully, but these errors were encountered: