MediaWiki REL1_31
|
Public Member Functions | |
__construct (LoadBalancer $dbLoadBalancer, WANObjectCache $cache, LoggerInterface $logger, $table, $idField, $nameField, callable $normalizationCallback=null, $wikiId=false) | |
acquireId ( $name) | |
Acquire the id of the given name. | |
getId ( $name) | |
Get the id of the given name. | |
getMap () | |
Get the whole table, in no particular order as a map of ids to names. | |
getName ( $id) | |
Get the name of the given id. | |
Private Member Functions | |
getCacheKey () | |
getDBConnection ( $index, $flags=0) | |
getTableFromCachesOrReplica () | |
loadTable (IDatabase $db) | |
Gets the table from the db. | |
normalizeName ( $name) | |
purgeWANCache ( $purgeCallback) | |
Reap the WANCache entry for this table. | |
store ( $name) | |
Stores the given name in the DB, returning the ID when an insert occurs. | |
Private Attributes | |
WANObjectCache | $cache |
int | $cacheTTL |
string | $idField |
LoadBalancer | $loadBalancer |
LoggerInterface | $logger |
string | $nameField |
null callable | $normalizationCallback = null |
string | $table |
string[] | $tableCache = null |
bool string | $wikiId = false |
Definition at line 35 of file NameTableStore.php.
MediaWiki\Storage\NameTableStore::__construct | ( | LoadBalancer | $dbLoadBalancer, |
WANObjectCache | $cache, | ||
LoggerInterface | $logger, | ||
$table, | |||
$idField, | |||
$nameField, | |||
callable | $normalizationCallback = null, | ||
$wikiId = false ) |
LoadBalancer | $dbLoadBalancer | A load balancer for acquiring database connections |
WANObjectCache | $cache | A cache manager for caching data |
LoggerInterface | $logger | |
string | $table | |
string | $idField | |
string | $nameField | |
callable | $normalizationCallback | Normalization to be applied to names before being saved or queried. This should be a callback that accepts and returns a single string. |
bool | string | $wikiId | The ID of the target wiki database. Use false for the local wiki. |
Definition at line 75 of file NameTableStore.php.
References MediaWiki\Storage\NameTableStore\$cache, MediaWiki\Storage\NameTableStore\$idField, MediaWiki\Storage\NameTableStore\$logger, MediaWiki\Storage\NameTableStore\$nameField, MediaWiki\Storage\NameTableStore\$normalizationCallback, MediaWiki\Storage\NameTableStore\$table, MediaWiki\Storage\NameTableStore\$wikiId, cache, and table.
MediaWiki\Storage\NameTableStore::acquireId | ( | $name | ) |
Acquire the id of the given name.
This creates a row in the table if it doesn't already exist.
string | $name |
NameTableAccessException |
Definition at line 129 of file NameTableStore.php.
References $name, MediaWiki\Storage\NameTableStore\$table, cache, DB_MASTER, MediaWiki\Storage\NameTableStore\getCacheKey(), MediaWiki\Storage\NameTableStore\getDBConnection(), MediaWiki\Storage\NameTableStore\getTableFromCachesOrReplica(), MediaWiki\Storage\NameTableStore\loadTable(), MediaWiki\Storage\NameTableStore\normalizeName(), MediaWiki\Storage\NameTableStore\purgeWANCache(), and store.
|
private |
Definition at line 106 of file NameTableStore.php.
Referenced by MediaWiki\Storage\NameTableStore\acquireId(), MediaWiki\Storage\NameTableStore\getName(), and MediaWiki\Storage\NameTableStore\getTableFromCachesOrReplica().
|
private |
int | $index | A database index, like DB_MASTER or DB_REPLICA |
int | $flags | Database connection flags |
Definition at line 102 of file NameTableStore.php.
Referenced by MediaWiki\Storage\NameTableStore\acquireId(), MediaWiki\Storage\NameTableStore\getName(), MediaWiki\Storage\NameTableStore\getTableFromCachesOrReplica(), MediaWiki\Storage\NameTableStore\purgeWANCache(), and MediaWiki\Storage\NameTableStore\store().
MediaWiki\Storage\NameTableStore::getId | ( | $name | ) |
Get the id of the given name.
If the name doesn't exist this will throw. This should be used in cases where we believe the name already exists or want to check for existence.
string | $name |
NameTableAccessException | The name does not exist |
Definition at line 182 of file NameTableStore.php.
References MediaWiki\Storage\NameTableStore\$table, MediaWiki\Storage\NameTableStore\getTableFromCachesOrReplica(), MediaWiki\Storage\NameTableAccessException\newFromDetails(), MediaWiki\Storage\NameTableStore\normalizeName(), and table.
MediaWiki\Storage\NameTableStore::getMap | ( | ) |
Get the whole table, in no particular order as a map of ids to names.
This method could be subject to DB or cache lag.
Definition at line 266 of file NameTableStore.php.
References MediaWiki\Storage\NameTableStore\getTableFromCachesOrReplica().
MediaWiki\Storage\NameTableStore::getName | ( | $id | ) |
Get the name of the given id.
If the id doesn't exist this will throw. This should be used in cases where we believe the id already exists.
Note: Calls to this method will result in a master select for non existing IDs.
int | $id |
NameTableAccessException | The id does not exist |
Definition at line 207 of file NameTableStore.php.
References $source, MediaWiki\Storage\NameTableStore\$table, cache, DB_MASTER, DB_REPLICA, MediaWiki\Storage\NameTableStore\getCacheKey(), MediaWiki\Storage\NameTableStore\getDBConnection(), MediaWiki\Storage\NameTableStore\getTableFromCachesOrReplica(), MediaWiki\Storage\NameTableStore\loadTable(), MediaWiki\Storage\NameTableAccessException\newFromDetails(), and table.
|
private |
Definition at line 273 of file NameTableStore.php.
References $dbr, MediaWiki\Storage\NameTableStore\$table, MediaWiki\Storage\NameTableStore\$tableCache, cache, DB_REPLICA, MediaWiki\Storage\NameTableStore\getCacheKey(), MediaWiki\Storage\NameTableStore\getDBConnection(), and MediaWiki\Storage\NameTableStore\loadTable().
Referenced by MediaWiki\Storage\NameTableStore\acquireId(), MediaWiki\Storage\NameTableStore\getId(), MediaWiki\Storage\NameTableStore\getMap(), and MediaWiki\Storage\NameTableStore\getName().
|
private |
Gets the table from the db.
IDatabase | $db |
Definition at line 316 of file NameTableStore.php.
References Wikimedia\Rdbms\IDatabase\select(), and table.
Referenced by MediaWiki\Storage\NameTableStore\acquireId(), MediaWiki\Storage\NameTableStore\getName(), and MediaWiki\Storage\NameTableStore\getTableFromCachesOrReplica().
|
private |
string | $name |
Definition at line 114 of file NameTableStore.php.
References $name.
Referenced by MediaWiki\Storage\NameTableStore\acquireId(), and MediaWiki\Storage\NameTableStore\getId().
|
private |
Reap the WANCache entry for this table.
callable | $purgeCallback | callback to 'purge' the WAN cache |
Definition at line 298 of file NameTableStore.php.
References DB_MASTER, and MediaWiki\Storage\NameTableStore\getDBConnection().
Referenced by MediaWiki\Storage\NameTableStore\acquireId().
|
private |
Stores the given name in the DB, returning the ID when an insert occurs.
string | $name |
Definition at line 342 of file NameTableStore.php.
References DB_MASTER, MediaWiki\Storage\NameTableStore\getDBConnection(), and table.
|
private |
Definition at line 41 of file NameTableStore.php.
Referenced by MediaWiki\Storage\NameTableStore\__construct().
|
private |
Definition at line 53 of file NameTableStore.php.
|
private |
Definition at line 58 of file NameTableStore.php.
Referenced by MediaWiki\Storage\NameTableStore\__construct().
|
private |
Definition at line 38 of file NameTableStore.php.
|
private |
Definition at line 44 of file NameTableStore.php.
Referenced by MediaWiki\Storage\NameTableStore\__construct().
|
private |
Definition at line 60 of file NameTableStore.php.
Referenced by MediaWiki\Storage\NameTableStore\__construct().
|
private |
Definition at line 62 of file NameTableStore.php.
Referenced by MediaWiki\Storage\NameTableStore\__construct().
|
private |
Definition at line 56 of file NameTableStore.php.
Referenced by MediaWiki\Storage\NameTableStore\__construct(), MediaWiki\Storage\NameTableStore\acquireId(), MediaWiki\Storage\NameTableStore\getId(), MediaWiki\Storage\NameTableStore\getName(), and MediaWiki\Storage\NameTableStore\getTableFromCachesOrReplica().
|
private |
Definition at line 47 of file NameTableStore.php.
Referenced by MediaWiki\Storage\NameTableStore\getTableFromCachesOrReplica().
|
private |
Definition at line 50 of file NameTableStore.php.
Referenced by MediaWiki\Storage\NameTableStore\__construct().