49 foreach ( $arr as $item ) {
68 public function addObj( $linkTarget ) {
69 if ( is_object( $linkTarget ) ) {
70 $this->
add( $linkTarget->getNamespace(), $linkTarget->getDBkey() );
72 wfDebug(
"Warning: LinkBatch::addObj got invalid LinkTarget object\n" );
80 public function add( $ns, $dbkey ) {
81 if ( $ns < 0 || $dbkey ===
'' ) {
84 if ( !array_key_exists( $ns, $this->data ) ) {
85 $this->data[$ns] = [];
88 $this->data[$ns][strtr( $dbkey,
' ',
'_' )] = 1;
116 return count( $this->data );
125 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
160 $titleFormatter = MediaWikiServices::getInstance()->getTitleFormatter();
165 foreach (
$res as $row ) {
166 $title =
new TitleValue( (
int)$row->page_namespace, $row->page_title );
167 $cache->addGoodLinkObjFromRow( $title, $row );
168 $pdbk = $titleFormatter->getPrefixedDBkey( $title );
169 $ids[$pdbk] = $row->page_id;
170 unset( $remaining[$row->page_namespace][$row->page_title] );
174 foreach ( $remaining as $ns => $dbkeys ) {
175 foreach ( $dbkeys as $dbkey => $unused ) {
176 $title =
new TitleValue( (
int)$ns, (
string)$dbkey );
177 $cache->addBadLinkObj( $title );
178 $pdbk = $titleFormatter->getPrefixedDBkey( $title );
198 $fields = array_merge(
199 LinkCache::getSelectFields(),
200 [
'page_namespace',
'page_title' ]
207 if ( strval( $this->caller ) !==
'' ) {
208 $caller .=
" (for {$this->caller})";
230 $genderCache = MediaWikiServices::getInstance()->getGenderCache();
231 $genderCache->doLinkBatch( $this->data, $this->caller );
244 return $db->makeWhereFrom2d( $this->data,
"{$prefix}_namespace",
"{$prefix}_title" );
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.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
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