48 foreach ( $arr
as $item ) {
67 public function addObj( $linkTarget ) {
68 if ( is_object( $linkTarget ) ) {
69 $this->
add( $linkTarget->getNamespace(), $linkTarget->getDBkey() );
71 wfDebug(
"Warning: LinkBatch::addObj got invalid LinkTarget object\n" );
79 public function add( $ns, $dbkey ) {
80 if ( $ns < 0 || $dbkey ===
'' ) {
83 if ( !array_key_exists( $ns, $this->
data ) ) {
84 $this->
data[$ns] = [];
87 $this->
data[$ns][strtr( $dbkey,
' ',
'_' )] = 1;
115 return count( $this->
data );
124 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
159 $titleFormatter = MediaWikiServices::getInstance()->getTitleFormatter();
164 foreach (
$res as $row ) {
167 $pdbk = $titleFormatter->getPrefixedDBkey(
$title );
168 $ids[$pdbk] = $row->page_id;
169 unset( $remaining[$row->page_namespace][$row->page_title] );
173 foreach ( $remaining
as $ns => $dbkeys ) {
174 foreach ( $dbkeys
as $dbkey => $unused ) {
177 $pdbk = $titleFormatter->getPrefixedDBkey(
$title );
197 $fields = array_merge(
199 [
'page_namespace',
'page_title' ]
206 if ( strval( $this->caller ) !==
'' ) {
207 $caller .=
" (for {$this->caller})";
225 if ( !$wgContLang->needsGenderDistinction() ) {
229 $genderCache = MediaWikiServices::getInstance()->getGenderCache();
230 $genderCache->doLinkBatch( $this->
data, $this->caller );
243 return $db->makeWhereFrom2d( $this->
data,
"{$prefix}_namespace",
"{$prefix}_title" );
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of data
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Represents a page (or page fragment) title within MediaWiki.
doGenderQuery()
Do (and cache) {{GENDER:...}} information for userpages in this LinkBatch.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
setCaller($caller)
Use ->setCaller( METHOD ) to indicate which code is using this class.
when a variable name is used in a it is silently declared as a new local masking the global
__construct($arr=[])
LinkBatch constructor.
wfDebug($text, $dest= 'all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
isEmpty()
Returns true if no pages have been added, false otherwise.
constructSet($prefix, $db)
Construct a WHERE clause which will match all the given titles.
$caller
For debugging which method is using this class.
doQuery()
Perform the existence test query, return a ResultWrapper with page_id fields.
namespace and then decline to actually register it file or subcat img or subcat $title
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
addResultToCache($cache, $res)
Add a ResultWrapper containing IDs and titles to a LinkCache object.
static getSelectFields()
Fields that LinkCache needs to select.
$data
2-d array, first index namespace, second index dbkey, value arbitrary
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
execute()
Do the query and add the results to the LinkCache object.
executeInto(&$cache)
Do the query and add the results to a given LinkCache object Return an array mapping PDBK to ID...
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
setArray($array)
Set the link list to a given 2-d array First key is the namespace, second is the DB key...
getSize()
Returns the size of the batch.