38 public static function hasFlags( $bitfield, $flags ) {
39 return ( $bitfield & $flags ) == $flags;
51 if ( self::hasFlags( $bitfield, IDBAccessObject::READ_LATEST_IMMUTABLE ) ) {
53 } elseif ( self::hasFlags( $bitfield, IDBAccessObject::READ_LATEST ) ) {
60 if ( self::hasFlags( $bitfield, IDBAccessObject::READ_EXCLUSIVE ) ) {
61 $lockingOptions[] =
'FOR UPDATE';
62 } elseif ( self::hasFlags( $bitfield, IDBAccessObject::READ_LOCKING ) ) {
63 $lockingOptions[] =
'LOCK IN SHARE MODE';
66 return [ $index, $lockingOptions ];
85 throw new InvalidArgumentException(
'$index must be either DB_REPLICA or DB_PRIMARY' );
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
if(!defined('MW_SETUP_CALLBACK'))
Helper class for DAO classes.
static getDBFromRecency(IConnectionProvider $dbProvider, int $recency)
static getDBOptions( $bitfield)
Get an appropriate DB index and options.
static getDBFromIndex(IConnectionProvider $dbProvider, int $index)
Takes $index from ::getDBOptions() and return proper Database object.
static hasFlags( $bitfield, $flags)
Interface for database access objects.