|
MediaWiki master
|
Batch query for page metadata and feed to LinkCache. More...
Public Member Functions | |
| __construct (iterable $arr, private LinkCache $linkCache, private TitleFormatter $titleFormatter, private Language $contentLanguage, private GenderCache $genderCache, private IConnectionProvider $dbProvider, private LinksMigration $linksMigration, private TempUserDetailsLookup $tempUserDetailsLookup, private LinkAlwaysKnownLookup $linkAlwaysKnownLookup, private LoggerInterface $logger) | |
| add ( $ns, $dbkey) | |
| addObj ( $link) | |
| addResultToCache ( $cache, $res) | |
| Add a database result with page rows to the LinkCache. | |
| addUser (UserIdentity $user) | |
| Add user page and user talk page for a given user to this batch. | |
| constructSet ( $prefix, $db) | |
| Construct a WHERE clause which will match all the given titles. | |
| doGenderQuery () | |
Execute and cache {{GENDER:...}} information for user pages in this LinkBatch. | |
| doIsAlwaysKnownQuery () | |
| doQuery () | |
| Perform the existence test query. | |
| execute () | |
| Do the query and add the results to the LinkCache. | |
| getPageIdentities () | |
| Do the query, add the results to the LinkCache object, and return ProperPageIdentity instances corresponding to the pages in the batch. | |
| getSize () | |
| Return the size of the batch. | |
| isEmpty () | |
| Whether no pages have been added. | |
| setArray ( $array) | |
| Replace the link batch with a given 2-d array. | |
| setCaller ( $caller) | |
| Set the function name to attribute database queries to, in debug logs. | |
Public Attributes | |
| array< int, array< string, mixed > > | $data = [] |
| 2-d array, first index namespace, second index dbkey, value arbitrary | |
Protected Member Functions | |
| executeInto ( $cache) | |
| Do the query and add the results to a given LinkCache object. | |
Protected Attributes | |
| string null | $caller |
| For debugging which method is using this class. | |
Batch query for page metadata and feed to LinkCache.
Use via MediaWikiServices::getLinkBatchFactory()->newLinkBatch(), and then call LinkBatch::execute().
Definition at line 36 of file LinkBatch.php.
| MediaWiki\Page\LinkBatch::__construct | ( | iterable | $arr, |
| private LinkCache | $linkCache, | ||
| private TitleFormatter | $titleFormatter, | ||
| private Language | $contentLanguage, | ||
| private GenderCache | $genderCache, | ||
| private IConnectionProvider | $dbProvider, | ||
| private LinksMigration | $linksMigration, | ||
| private TempUserDetailsLookup | $tempUserDetailsLookup, | ||
| private LinkAlwaysKnownLookup | $linkAlwaysKnownLookup, | ||
| private LoggerInterface | $logger ) |
| iterable<LinkTarget>|iterable<PageReference> | $arr Initial titles to be added to the batch |
Definition at line 63 of file LinkBatch.php.
References MediaWiki\Page\LinkBatch\addObj().
| MediaWiki\Page\LinkBatch::add | ( | $ns, | |
| $dbkey ) |
| int | $ns | |
| string | $dbkey |
Definition at line 137 of file LinkBatch.php.
| MediaWiki\Page\LinkBatch::addObj | ( | $link | ) |
| LinkTarget | PageReference | $link |
Definition at line 111 of file LinkBatch.php.
References MediaWiki\Linker\LinkTarget\isExternal().
Referenced by MediaWiki\Page\LinkBatch\__construct().
| MediaWiki\Page\LinkBatch::addResultToCache | ( | $cache, | |
| $res ) |
Add a database result with page rows to the LinkCache.
As normal, titles will go into the static Title cache field. This function also stores extra fields of the title used for link parsing to avoid extra DB queries.
| LinkCache | $cache | |
| IResultWrapper | $res |
Definition at line 229 of file LinkBatch.php.
| MediaWiki\Page\LinkBatch::addUser | ( | UserIdentity | $user | ) |
Add user page and user talk page for a given user to this batch.
Calling execute will also prefetch the expiration status of temporary accounts added this way, which is needed for the efficient rendering of user links via UserLinkRenderer.
Definition at line 101 of file LinkBatch.php.
| MediaWiki\Page\LinkBatch::constructSet | ( | $prefix, | |
| $db ) |
Construct a WHERE clause which will match all the given titles.
It is the caller's responsibility to only call this if the LinkBatch is not empty, because there is no safe way to represent a SQL conditional for the empty set.
| string | $prefix | The appropriate table's field name prefix ('page', 'pl', etc) |
| ISQLPlatform | $db | DB object to use |
Definition at line 368 of file LinkBatch.php.
| MediaWiki\Page\LinkBatch::doGenderQuery | ( | ) |
Execute and cache {{GENDER:...}} information for user pages in this LinkBatch.
Definition at line 321 of file LinkBatch.php.
| MediaWiki\Page\LinkBatch::doIsAlwaysKnownQuery | ( | ) |
Definition at line 331 of file LinkBatch.php.
| MediaWiki\Page\LinkBatch::doQuery | ( | ) |
Perform the existence test query.
Definition at line 296 of file LinkBatch.php.
| MediaWiki\Page\LinkBatch::execute | ( | ) |
Do the query and add the results to the LinkCache.
Definition at line 179 of file LinkBatch.php.
|
protected |
Do the query and add the results to a given LinkCache object.
| LinkCache | $cache |
Definition at line 204 of file LinkBatch.php.
| MediaWiki\Page\LinkBatch::getPageIdentities | ( | ) |
Do the query, add the results to the LinkCache object, and return ProperPageIdentity instances corresponding to the pages in the batch.
Definition at line 190 of file LinkBatch.php.
| MediaWiki\Page\LinkBatch::getSize | ( | ) |
| MediaWiki\Page\LinkBatch::isEmpty | ( | ) |
| MediaWiki\Page\LinkBatch::setArray | ( | $array | ) |
Replace the link batch with a given 2-d array.
First key is the namespace, second is the DB key, value arbitrary
| array<int,array<string,mixed>> | $array |
Definition at line 152 of file LinkBatch.php.
| MediaWiki\Page\LinkBatch::setCaller | ( | $caller | ) |
Set the function name to attribute database queries to, in debug logs.
| string | $caller |
Definition at line 88 of file LinkBatch.php.
|
protected |
For debugging which method is using this class.
Definition at line 55 of file LinkBatch.php.
| array<int,array<string,mixed> > MediaWiki\Page\LinkBatch::$data = [] |
2-d array, first index namespace, second index dbkey, value arbitrary
Definition at line 40 of file LinkBatch.php.