MediaWiki  master
DBAccessObjectUtils Class Reference

Helper class for DAO classes. More...

Inheritance diagram for DBAccessObjectUtils:
Collaboration diagram for DBAccessObjectUtils:

Static Public Member Functions

static getDBOptions ( $bitfield)
 Get an appropriate DB index, options, and fallback DB index for a query. More...
 
static hasFlags ( $bitfield, $flags)
 

Additional Inherited Members

- Public Attributes inherited from IDBAccessObject
const READ_LOCKING = self::READ_LATEST | 2
 Constants for object loading bitfield flags (higher => higher QoS) More...
 
const READ_NONE = -1
 

Detailed Description

Helper class for DAO classes.

Since
1.26

Definition at line 29 of file DBAccessObjectUtils.php.

Member Function Documentation

◆ getDBOptions()

static DBAccessObjectUtils::getDBOptions (   $bitfield)
static

Get an appropriate DB index, options, and fallback DB index for a query.

The fallback DB index and options are to be used if the entity is not found with the initial DB index, typically querying the master DB to avoid lag

Parameters
int$bitfieldBitfield of IDBAccessObject::READ_* constants
Returns
array List of DB indexes and options in this order:
  • DB_MASTER or DB_REPLICA constant for the initial query
  • SELECT options array for the initial query
  • DB_MASTER constant for the fallback query; null if no fallback should happen
  • SELECT options array for the fallback query; empty if no fallback should happen

Definition at line 52 of file DBAccessObjectUtils.php.

References $options, DB_MASTER, DB_REPLICA, and null.

Referenced by MediaWiki\Storage\SqlBlobStore\fetchBlob(), User\getActorId(), Revision\RevisionStore\getDBConnectionRefForQueryFlags(), BotPassword\getPassword(), Revision\RevisionStore\getRecentChange(), Revision\RevisionStore\getTitle(), User\idFromName(), User\load(), User\loadFromDatabase(), WikiPage\loadPageData(), Revision\RevisionStore\loadSlotRecords(), LocalIdLookup\lookupCentralIds(), LocalIdLookup\lookupUserNames(), BotPassword\newFromCentralId(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\testUserExists(), and MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\testUserExists().

◆ hasFlags()

static DBAccessObjectUtils::hasFlags (   $bitfield,
  $flags 
)
static
Parameters
int$bitfield
int$flagsIDBAccessObject::READ_* constant
Returns
bool Bitfield has flag $flag set

Definition at line 35 of file DBAccessObjectUtils.php.

Referenced by MediaWiki\Storage\SqlBlobStore\fetchBlob(), Revision\RevisionStore\getTitle(), User\loadFromId(), and Title\loadRestrictions().


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