35 static $instance = null;
36 if ( $instance === null ) {
37 $instance =
new self();
53 public function getProp( $userId, $prop ) {
54 if ( !isset( $this->
cache[$userId][$prop] ) ) {
55 wfDebug( __METHOD__ .
": querying DB for prop '$prop' for user ID '$userId'.\n" );
59 return isset( $this->
cache[$userId][$prop] )
60 ? $this->
cache[$userId][$prop]
73 return $userId > 0 ? $this->
getProp( $userId,
'name' ) : $ip;
87 $userIds = array_unique( $userIds );
89 foreach ( $userIds
as $userId ) {
90 $userId = (int)$userId;
94 if ( isset( $this->
cache[$userId][
'name'] ) ) {
95 $usersToCheck[$userId] = $this->
cache[$userId][
'name'];
97 $usersToQuery[] = $userId;
102 if ( count( $usersToQuery ) ) {
105 $conds = [
'user_id' => $usersToQuery ];
106 $fields = [
'user_name',
'user_real_name',
'user_registration',
'user_id' ];
109 if ( strval( $caller ) !==
'' ) {
114 foreach (
$res as $row ) {
115 $userId = (int)$row->user_id;
116 $this->cache[$userId][
'name'] = $row->user_name;
117 $this->cache[$userId][
'real_name'] = $row->user_real_name;
118 $this->cache[$userId][
'registration'] = $row->user_registration;
119 $usersToCheck[$userId] = $row->user_name;
124 foreach ( $usersToCheck
as $userId =>
$name ) {
127 $this->typesCached[$userId][
'userpage'] = 1;
131 $this->typesCached[$userId][
'usertalk'] = 1;
147 return ( in_array(
$type, $options ) && !isset( $this->typesCached[$uid][
$type] ) );
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
the array() calling protocol came about after MediaWiki 1.4rc1.
wfDebug($text, $dest= 'all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
you have access to all of the normal MediaWiki so you can get a DB use the cache
Class representing a list of titles The execute() method checks them all for existence and adds them ...
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
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
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
getUserName($userId, $ip)
Get the name of a user or return $ip if the user ID is 0.
getProp($userId, $prop)
Get a property of a user based on their user ID.
doQuery(array $userIds, $options=[], $caller= '')
Preloads user names for given list of users.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
queryNeeded($uid, $type, array $options)
Check if a cache type is in $options and was not loaded for this user.
Allows to change the fields on the form that will be generated $name