MediaWiki master
Wikimedia\Rdbms\ChangedTablesTracker Class Reference

Utility class that keeps a list of DB tables that were (presumably) changed by write queries. More...

Static Public Member Functions

static getTables (string $domainId)
 Get the tables for a given domain ID.
 
static recordQuery (DatabaseDomain $domain, Query $query)
 When tracking is enabled and a query alters tables, record the list of tables that are altered.
 
static startTracking ()
 Enables query tracking and resets the list of changed tables.
 
static stopTracking ()
 Reset the internal list and disable tracking.
 

Detailed Description

Utility class that keeps a list of DB tables that were (presumably) changed by write queries.

This should only be used in PHPUnit tests. This class should remain a static util class, because it must never be replaced by a mock in tests.

Access: internal

Definition at line 15 of file ChangedTablesTracker.php.

Member Function Documentation

◆ getTables()

static Wikimedia\Rdbms\ChangedTablesTracker::getTables ( string $domainId)
static

Get the tables for a given domain ID.

Parameters
string$domainId
Returns
string[]

Definition at line 41 of file ChangedTablesTracker.php.

◆ recordQuery()

static Wikimedia\Rdbms\ChangedTablesTracker::recordQuery ( DatabaseDomain $domain,
Query $query )
static

When tracking is enabled and a query alters tables, record the list of tables that are altered.

Any table that gets dropped gets removed from the list of altered tables.

Definition at line 61 of file ChangedTablesTracker.php.

Referenced by Wikimedia\Rdbms\Database\executeQuery().

◆ startTracking()

static Wikimedia\Rdbms\ChangedTablesTracker::startTracking ( )
static

Enables query tracking and resets the list of changed tables.

Definition at line 24 of file ChangedTablesTracker.php.

◆ stopTracking()

static Wikimedia\Rdbms\ChangedTablesTracker::stopTracking ( )
static

Reset the internal list and disable tracking.

Definition at line 49 of file ChangedTablesTracker.php.


The documentation for this class was generated from the following file: