49 foreach ( $arr as $item ) {
71 public function addObj( $linkTarget ) {
73 $this->
add( $linkTarget->getNamespace(), $linkTarget->getDBkey() );
75 wfDebug(
"Warning: LinkBatch::addObj got invalid LinkTarget object\n" );
83 public function add( $ns, $dbkey ) {
84 if ( $ns < 0 || $dbkey ===
'' ) {
88 $this->data[$ns] = [];
91 $this->data[$ns][
strtr( $dbkey,
' ',
'_' )] = 1;
101 $this->data = $array;
119 return count( $this->data );
128 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
163 $titleFormatter = MediaWikiServices::getInstance()->getTitleFormatter();
168 foreach (
$res as $row ) {
169 $title =
new TitleValue( (
int)$row->page_namespace, $row->page_title );
170 $cache->addGoodLinkObjFromRow( $title, $row );
171 $pdbk = $titleFormatter->getPrefixedDBkey( $title );
172 $ids[
$pdbk] = $row->page_id;
173 unset( $remaining[$row->page_namespace][$row->page_title] );
177 foreach ( $remaining as $ns => $dbkeys ) {
178 foreach ( $dbkeys as $dbkey => $unused ) {
179 $title =
new TitleValue( (
int)$ns, (
string)$dbkey );
180 $cache->addBadLinkObj( $title );
181 $pdbk = $titleFormatter->getPrefixedDBkey( $title );
202 LinkCache::getSelectFields(),
203 [
'page_namespace',
'page_title' ]
210 if (
strval( $this->caller ) !==
'' ) {
211 $caller .=
" (for {$this->caller})";
227 $services = MediaWikiServices::getInstance();
229 if ( !
$services->getContentLanguage()->needsGenderDistinction() ) {
233 $genderCache =
$services->getGenderCache();
234 $genderCache->doLinkBatch( $this->data, $this->caller );
247 return $db->makeWhereFrom2d( $this->data,
"{$prefix}_namespace",
"{$prefix}_title" );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
doGenderQuery()
Do (and cache) {{GENDER:...}} information for userpages in this LinkBatch.
$data
2-d array, first index namespace, second index dbkey, value arbitrary
getSize()
Returns the size of the batch.
addResultToCache( $cache, $res)
Add a ResultWrapper containing IDs and titles to a LinkCache object.
$caller
For debugging which method is using this class.
isEmpty()
Returns true if no pages have been added, false otherwise.
setCaller( $caller)
Use ->setCaller( METHOD ) to indicate which code is using this class.
constructSet( $prefix, $db)
Construct a WHERE clause which will match all the given titles.
execute()
Do the query and add the results to the LinkCache object.
setArray( $array)
Set the link list to a given 2-d array First key is the namespace, second is the DB key,...
executeInto(&$cache)
Do the query and add the results to a given LinkCache object Return an array mapping PDBK to ID.
doQuery()
Perform the existence test query, return a ResultWrapper with page_id fields.
Represents a page (or page fragment) title within MediaWiki.
An extension or a local will often add custom code to the function with or without a global variable For someone wanting email notification when an article is shown may add
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place or wrap services the preferred way to define a new service is the $wgServiceWiringFiles array $services