MediaWiki  1.23.2
ApiQueryBlocks.php
Go to the documentation of this file.
1 <?php
33 
37  protected $usernames;
38 
39  public function __construct( $query, $moduleName ) {
40  parent::__construct( $query, $moduleName, 'bk' );
41  }
42 
43  public function execute() {
45 
46  $db = $this->getDB();
47  $params = $this->extractRequestParams();
48  $this->requireMaxOneParameter( $params, 'users', 'ip' );
49 
50  $prop = array_flip( $params['prop'] );
51  $fld_id = isset( $prop['id'] );
52  $fld_user = isset( $prop['user'] );
53  $fld_userid = isset( $prop['userid'] );
54  $fld_by = isset( $prop['by'] );
55  $fld_byid = isset( $prop['byid'] );
56  $fld_timestamp = isset( $prop['timestamp'] );
57  $fld_expiry = isset( $prop['expiry'] );
58  $fld_reason = isset( $prop['reason'] );
59  $fld_range = isset( $prop['range'] );
60  $fld_flags = isset( $prop['flags'] );
61 
62  $result = $this->getResult();
63 
64  $this->addTables( 'ipblocks' );
65  $this->addFields( array( 'ipb_auto', 'ipb_id' ) );
66 
67  $this->addFieldsIf( array( 'ipb_address', 'ipb_user' ), $fld_user || $fld_userid );
68  $this->addFieldsIf( 'ipb_by_text', $fld_by );
69  $this->addFieldsIf( 'ipb_by', $fld_byid );
70  $this->addFieldsIf( 'ipb_timestamp', $fld_timestamp );
71  $this->addFieldsIf( 'ipb_expiry', $fld_expiry );
72  $this->addFieldsIf( 'ipb_reason', $fld_reason );
73  $this->addFieldsIf( array( 'ipb_range_start', 'ipb_range_end' ), $fld_range );
74  $this->addFieldsIf( array( 'ipb_anon_only', 'ipb_create_account', 'ipb_enable_autoblock',
75  'ipb_block_email', 'ipb_deleted', 'ipb_allow_usertalk' ),
76  $fld_flags );
77 
78  $this->addOption( 'LIMIT', $params['limit'] + 1 );
80  'ipb_timestamp',
81  $params['dir'],
82  $params['start'],
83  $params['end']
84  );
85  // Include in ORDER BY for uniqueness
86  $this->addWhereRange( 'ipb_id', $params['dir'], null, null );
87 
88  if ( !is_null( $params['continue'] ) ) {
89  $cont = explode( '|', $params['continue'] );
90  $this->dieContinueUsageIf( count( $cont ) != 2 );
91  $op = ( $params['dir'] == 'newer' ? '>' : '<' );
92  $continueTimestamp = $db->addQuotes( $db->timestamp( $cont[0] ) );
93  $continueId = (int)$cont[1];
94  $this->dieContinueUsageIf( $continueId != $cont[1] );
95  $this->addWhere( "ipb_timestamp $op $continueTimestamp OR " .
96  "(ipb_timestamp = $continueTimestamp AND " .
97  "ipb_id $op= $continueId)"
98  );
99  }
100 
101  if ( isset( $params['ids'] ) ) {
102  $this->addWhereFld( 'ipb_id', $params['ids'] );
103  }
104  if ( isset( $params['users'] ) ) {
105  foreach ( (array)$params['users'] as $u ) {
106  $this->prepareUsername( $u );
107  }
108  $this->addWhereFld( 'ipb_address', $this->usernames );
109  $this->addWhereFld( 'ipb_auto', 0 );
110  }
111  if ( isset( $params['ip'] ) ) {
112  global $wgBlockCIDRLimit;
113  if ( IP::isIPv4( $params['ip'] ) ) {
114  $type = 'IPv4';
115  $cidrLimit = $wgBlockCIDRLimit['IPv4'];
116  $prefixLen = 0;
117  } elseif ( IP::isIPv6( $params['ip'] ) ) {
118  $type = 'IPv6';
119  $cidrLimit = $wgBlockCIDRLimit['IPv6'];
120  $prefixLen = 3; // IP::toHex output is prefixed with "v6-"
121  } else {
122  $this->dieUsage( 'IP parameter is not valid', 'param_ip' );
123  }
124 
125  # Check range validity, if it's a CIDR
126  list( $ip, $range ) = IP::parseCIDR( $params['ip'] );
127  if ( $ip !== false && $range !== false && $range < $cidrLimit ) {
128  $this->dieUsage(
129  "$type CIDR ranges broader than /$cidrLimit are not accepted",
130  'cidrtoobroad'
131  );
132  }
133 
134  # Let IP::parseRange handle calculating $upper, instead of duplicating the logic here.
135  list( $lower, $upper ) = IP::parseRange( $params['ip'] );
136 
137  # Extract the common prefix to any rangeblock affecting this IP/CIDR
138  $prefix = substr( $lower, 0, $prefixLen + floor( $cidrLimit / 4 ) );
139 
140  # Fairly hard to make a malicious SQL statement out of hex characters,
141  # but it is good practice to add quotes
142  $lower = $db->addQuotes( $lower );
143  $upper = $db->addQuotes( $upper );
144 
145  $this->addWhere( array(
146  'ipb_range_start' . $db->buildLike( $prefix, $db->anyString() ),
147  'ipb_range_start <= ' . $lower,
148  'ipb_range_end >= ' . $upper,
149  'ipb_auto' => 0
150  ) );
151  }
152 
153  if ( !is_null( $params['show'] ) ) {
154  $show = array_flip( $params['show'] );
155 
156  /* Check for conflicting parameters. */
157  if ( ( isset( $show['account'] ) && isset( $show['!account'] ) )
158  || ( isset( $show['ip'] ) && isset( $show['!ip'] ) )
159  || ( isset( $show['range'] ) && isset( $show['!range'] ) )
160  || ( isset( $show['temp'] ) && isset( $show['!temp'] ) )
161  ) {
162  $this->dieUsageMsg( 'show' );
163  }
164 
165  $this->addWhereIf( 'ipb_user = 0', isset( $show['!account'] ) );
166  $this->addWhereIf( 'ipb_user != 0', isset( $show['account'] ) );
167  $this->addWhereIf( 'ipb_user != 0 OR ipb_range_end > ipb_range_start', isset( $show['!ip'] ) );
168  $this->addWhereIf( 'ipb_user = 0 AND ipb_range_end = ipb_range_start', isset( $show['ip'] ) );
169  $this->addWhereIf( 'ipb_expiry = ' .
170  $db->addQuotes( $db->getInfinity() ), isset( $show['!temp'] ) );
171  $this->addWhereIf( 'ipb_expiry != ' .
172  $db->addQuotes( $db->getInfinity() ), isset( $show['temp'] ) );
173  $this->addWhereIf( 'ipb_range_end = ipb_range_start', isset( $show['!range'] ) );
174  $this->addWhereIf( 'ipb_range_end > ipb_range_start', isset( $show['range'] ) );
175  }
176 
177  if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
178  $this->addWhereFld( 'ipb_deleted', 0 );
179  }
180 
181  // Purge expired entries on one in every 10 queries
182  if ( !mt_rand( 0, 10 ) ) {
184  }
185 
186  $res = $this->select( __METHOD__ );
187 
188  $count = 0;
189  foreach ( $res as $row ) {
190  if ( ++$count > $params['limit'] ) {
191  // We've had enough
192  $this->setContinueEnumParameter( 'continue', "$row->ipb_timestamp|$row->ipb_id" );
193  break;
194  }
195  $block = array();
196  if ( $fld_id ) {
197  $block['id'] = $row->ipb_id;
198  }
199  if ( $fld_user && !$row->ipb_auto ) {
200  $block['user'] = $row->ipb_address;
201  }
202  if ( $fld_userid && !$row->ipb_auto ) {
203  $block['userid'] = $row->ipb_user;
204  }
205  if ( $fld_by ) {
206  $block['by'] = $row->ipb_by_text;
207  }
208  if ( $fld_byid ) {
209  $block['byid'] = $row->ipb_by;
210  }
211  if ( $fld_timestamp ) {
212  $block['timestamp'] = wfTimestamp( TS_ISO_8601, $row->ipb_timestamp );
213  }
214  if ( $fld_expiry ) {
215  $block['expiry'] = $wgContLang->formatExpiry( $row->ipb_expiry, TS_ISO_8601 );
216  }
217  if ( $fld_reason ) {
218  $block['reason'] = $row->ipb_reason;
219  }
220  if ( $fld_range && !$row->ipb_auto ) {
221  $block['rangestart'] = IP::formatHex( $row->ipb_range_start );
222  $block['rangeend'] = IP::formatHex( $row->ipb_range_end );
223  }
224  if ( $fld_flags ) {
225  // For clarity, these flags use the same names as their action=block counterparts
226  if ( $row->ipb_auto ) {
227  $block['automatic'] = '';
228  }
229  if ( $row->ipb_anon_only ) {
230  $block['anononly'] = '';
231  }
232  if ( $row->ipb_create_account ) {
233  $block['nocreate'] = '';
234  }
235  if ( $row->ipb_enable_autoblock ) {
236  $block['autoblock'] = '';
237  }
238  if ( $row->ipb_block_email ) {
239  $block['noemail'] = '';
240  }
241  if ( $row->ipb_deleted ) {
242  $block['hidden'] = '';
243  }
244  if ( $row->ipb_allow_usertalk ) {
245  $block['allowusertalk'] = '';
246  }
247  }
248  $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $block );
249  if ( !$fit ) {
250  $this->setContinueEnumParameter( 'continue', "$row->ipb_timestamp|$row->ipb_id" );
251  break;
252  }
253  }
254  $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'block' );
255  }
256 
257  protected function prepareUsername( $user ) {
258  if ( !$user ) {
259  $this->dieUsage( 'User parameter may not be empty', 'param_user' );
260  }
261  $name = User::isIP( $user )
262  ? $user
263  : User::getCanonicalName( $user, 'valid' );
264  if ( $name === false ) {
265  $this->dieUsage( "User name {$user} is not valid", 'param_user' );
266  }
267  $this->usernames[] = $name;
268  }
269 
270  public function getAllowedParams() {
271  return array(
272  'start' => array(
273  ApiBase::PARAM_TYPE => 'timestamp'
274  ),
275  'end' => array(
276  ApiBase::PARAM_TYPE => 'timestamp',
277  ),
278  'dir' => array(
280  'newer',
281  'older'
282  ),
283  ApiBase::PARAM_DFLT => 'older'
284  ),
285  'ids' => array(
286  ApiBase::PARAM_TYPE => 'integer',
287  ApiBase::PARAM_ISMULTI => true
288  ),
289  'users' => array(
290  ApiBase::PARAM_ISMULTI => true
291  ),
292  'ip' => null,
293  'limit' => array(
294  ApiBase::PARAM_DFLT => 10,
295  ApiBase::PARAM_TYPE => 'limit',
296  ApiBase::PARAM_MIN => 1,
299  ),
300  'prop' => array(
301  ApiBase::PARAM_DFLT => 'id|user|by|timestamp|expiry|reason|flags',
303  'id',
304  'user',
305  'userid',
306  'by',
307  'byid',
308  'timestamp',
309  'expiry',
310  'reason',
311  'range',
312  'flags'
313  ),
314  ApiBase::PARAM_ISMULTI => true
315  ),
316  'show' => array(
318  'account',
319  '!account',
320  'temp',
321  '!temp',
322  'ip',
323  '!ip',
324  'range',
325  '!range',
326  ),
327  ApiBase::PARAM_ISMULTI => true
328  ),
329  'continue' => null,
330  );
331  }
332 
333  public function getParamDescription() {
334  global $wgBlockCIDRLimit;
335  $p = $this->getModulePrefix();
336 
337  return array(
338  'start' => 'The timestamp to start enumerating from',
339  'end' => 'The timestamp to stop enumerating at',
340  'dir' => $this->getDirectionDescription( $p ),
341  'ids' => 'List of block IDs to list (optional)',
342  'users' => 'List of users to search for (optional)',
343  'ip' => array(
344  'Get all blocks applying to this IP or CIDR range, including range blocks.',
345  "Cannot be used together with bkusers. CIDR ranges broader than " .
346  "IPv4/{$wgBlockCIDRLimit['IPv4']} or IPv6/{$wgBlockCIDRLimit['IPv6']} " .
347  "are not accepted"
348  ),
349  'limit' => 'The maximum amount of blocks to list',
350  'prop' => array(
351  'Which properties to get',
352  ' id - Adds the ID of the block',
353  ' user - Adds the username of the blocked user',
354  ' userid - Adds the user ID of the blocked user',
355  ' by - Adds the username of the blocking user',
356  ' byid - Adds the user ID of the blocking user',
357  ' timestamp - Adds the timestamp of when the block was given',
358  ' expiry - Adds the timestamp of when the block expires',
359  ' reason - Adds the reason given for the block',
360  ' range - Adds the range of IPs affected by the block',
361  ' flags - Tags the ban with (autoblock, anononly, etc)',
362  ),
363  'show' => array(
364  'Show only items that meet this criteria.',
365  "For example, to see only indefinite blocks on IPs, set {$p}show=ip|!temp"
366  ),
367  'continue' => 'When more results are available, use this to continue',
368  );
369  }
370 
371  public function getResultProperties() {
372  return array(
373  'id' => array(
374  'id' => 'integer'
375  ),
376  'user' => array(
377  'user' => array(
378  ApiBase::PROP_TYPE => 'string',
379  ApiBase::PROP_NULLABLE => true
380  )
381  ),
382  'userid' => array(
383  'userid' => array(
384  ApiBase::PROP_TYPE => 'integer',
385  ApiBase::PROP_NULLABLE => true
386  )
387  ),
388  'by' => array(
389  'by' => 'string'
390  ),
391  'byid' => array(
392  'byid' => 'integer'
393  ),
394  'timestamp' => array(
395  'timestamp' => 'timestamp'
396  ),
397  'expiry' => array(
398  'expiry' => 'timestamp'
399  ),
400  'reason' => array(
401  'reason' => 'string'
402  ),
403  'range' => array(
404  'rangestart' => array(
405  ApiBase::PROP_TYPE => 'string',
406  ApiBase::PROP_NULLABLE => true
407  ),
408  'rangeend' => array(
409  ApiBase::PROP_TYPE => 'string',
410  ApiBase::PROP_NULLABLE => true
411  )
412  ),
413  'flags' => array(
414  'automatic' => 'boolean',
415  'anononly' => 'boolean',
416  'nocreate' => 'boolean',
417  'autoblock' => 'boolean',
418  'noemail' => 'boolean',
419  'hidden' => 'boolean',
420  'allowusertalk' => 'boolean'
421  )
422  );
423  }
424 
425  public function getDescription() {
426  return 'List all blocked users and IP addresses.';
427  }
428 
429  public function getPossibleErrors() {
430  global $wgBlockCIDRLimit;
431 
432  return array_merge( parent::getPossibleErrors(),
433  $this->getRequireMaxOneParameterErrorMessages( array( 'users', 'ip' ) ),
434  array(
435  array(
436  'code' => 'cidrtoobroad',
437  'info' => "IPv4 CIDR ranges broader than /{$wgBlockCIDRLimit['IPv4']} are not accepted"
438  ),
439  array(
440  'code' => 'cidrtoobroad',
441  'info' => "IPv6 CIDR ranges broader than /{$wgBlockCIDRLimit['IPv6']} are not accepted"
442  ),
443  array( 'code' => 'param_ip', 'info' => 'IP parameter is not valid' ),
444  array( 'code' => 'param_user', 'info' => 'User parameter may not be empty' ),
445  array( 'code' => 'param_user', 'info' => 'User name user is not valid' ),
446  array( 'show' ),
447  )
448  );
449  }
450 
451  public function getExamples() {
452  return array(
453  'api.php?action=query&list=blocks',
454  'api.php?action=query&list=blocks&bkusers=Alice|Bob'
455  );
456  }
457 
458  public function getHelpUrls() {
459  return 'https://www.mediawiki.org/wiki/API:Blocks';
460  }
461 }
$result
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1528
ApiQueryBase\addFields
addFields( $value)
Add a set of fields to select to the internal array.
Definition: ApiQueryBase.php:117
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ApiQueryBase\addTimestampWhereRange
addTimestampWhereRange( $field, $dir, $start, $end, $sort=true)
Add a WHERE clause corresponding to a range, similar to addWhereRange, but converts $start and $end t...
Definition: ApiQueryBase.php:240
ApiQueryBlocks\getAllowedParams
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Definition: ApiQueryBlocks.php:269
ApiBase\dieUsageMsg
dieUsageMsg( $error)
Output the error message related to a certain array.
Definition: ApiBase.php:1929
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:2483
ApiBase\PARAM_TYPE
const PARAM_TYPE
Definition: ApiBase.php:50
ApiQueryBlocks\getPossibleErrors
getPossibleErrors()
Definition: ApiQueryBlocks.php:428
ApiBase\getResult
getResult()
Get the result object.
Definition: ApiBase.php:205
ApiQueryBase\select
select( $method, $extraQuery=array())
Execute a SELECT query based on the values in the internal arrays.
Definition: ApiQueryBase.php:274
ApiQueryBase\getDirectionDescription
getDirectionDescription( $p='', $extraDirText='')
Gets the personalised direction parameter description.
Definition: ApiQueryBase.php:524
$params
$params
Definition: styleTest.css.php:40
IP\isIPv6
static isIPv6( $ip)
Given a string, determine if it as valid IP in IPv6 only.
Definition: IP.php:85
$wgContLang
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 content language as $wgContLang
Definition: design.txt:56
ApiQueryBase\addOption
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
Definition: ApiQueryBase.php:252
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:132
ApiQueryBase\addFieldsIf
addFieldsIf( $value, $condition)
Same as addFields(), but add the fields only if a condition is met.
Definition: ApiQueryBase.php:131
ApiQueryBlocks\getHelpUrls
getHelpUrls()
Definition: ApiQueryBlocks.php:457
ApiQueryBlocks
Query module to enumerate all user blocks.
Definition: ApiQueryBlocks.php:32
ApiBase\PARAM_MIN
const PARAM_MIN
Definition: ApiBase.php:56
ApiQueryBlocks\getDescription
getDescription()
Returns the description string for this module.
Definition: ApiQueryBlocks.php:424
ApiQueryBase
This is a base class for all Query modules.
Definition: ApiQueryBase.php:34
ApiBase\LIMIT_BIG1
const LIMIT_BIG1
Definition: ApiBase.php:78
TS_ISO_8601
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
Definition: GlobalFunctions.php:2448
ApiQueryBlocks\getParamDescription
getParamDescription()
Returns an array of parameter descriptions.
Definition: ApiQueryBlocks.php:332
ApiQueryBase\getDB
getDB()
Get the Query database connection (read-only)
Definition: ApiQueryBase.php:417
ApiBase\PARAM_MAX
const PARAM_MAX
Definition: ApiBase.php:52
User\isIP
static isIP( $name)
Does the string match an anonymous IPv4 address?
Definition: User.php:554
ApiQueryBase\addTables
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
Definition: ApiQueryBase.php:82
ApiQueryBlocks\$usernames
Array $usernames
Definition: ApiQueryBlocks.php:36
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
ApiQueryBlocks\prepareUsername
prepareUsername( $user)
Definition: ApiQueryBlocks.php:256
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
ApiBase\PROP_TYPE
const PROP_TYPE
Definition: ApiBase.php:74
list
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
ApiBase\getModulePrefix
getModulePrefix()
Get parameter prefix (usually two letters or an empty string).
Definition: ApiBase.php:165
ApiQueryBase\addWhereRange
addWhereRange( $field, $dir, $start, $end, $sort=true)
Add a WHERE clause corresponding to a range, and an ORDER BY clause to sort in the right direction.
Definition: ApiQueryBase.php:205
ApiBase\extractRequestParams
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
Definition: ApiBase.php:687
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
ApiBase\dieContinueUsageIf
dieContinueUsageIf( $condition)
Die with the $prefix.
Definition: ApiBase.php:1965
ApiBase\dieUsage
dieUsage( $description, $errorCode, $httpRespCode=0, $extradata=null)
Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an...
Definition: ApiBase.php:1363
ApiQueryBlocks\getExamples
getExamples()
Returns usage examples for this module.
Definition: ApiQueryBlocks.php:450
IP\parseRange
static parseRange( $range)
Given a string range in a number of formats, return the start and end of the range in hexadecimal.
Definition: IP.php:564
ApiQueryBlocks\__construct
__construct( $query, $moduleName)
Definition: ApiQueryBlocks.php:38
ApiBase\PROP_NULLABLE
const PROP_NULLABLE
Definition: ApiBase.php:76
ApiQueryBase\addWhereFld
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
Definition: ApiQueryBase.php:185
Block\purgeExpired
static purgeExpired()
Purge expired blocks from the ipblocks table.
Definition: Block.php:937
ApiQueryBlocks\execute
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
Definition: ApiQueryBlocks.php:42
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
IP\isIPv4
static isIPv4( $ip)
Given a string, determine if it as valid IP in IPv4 only.
Definition: IP.php:96
IP\parseCIDR
static parseCIDR( $range)
Convert a network specification in CIDR notation to an integer network and a number of bits.
Definition: IP.php:521
$count
$count
Definition: UtfNormalTest2.php:96
ApiQueryBlocks\getResultProperties
getResultProperties()
Returns possible properties in the result, grouped by the value of the prop parameter that shows them...
Definition: ApiQueryBlocks.php:370
ApiBase\LIMIT_BIG2
const LIMIT_BIG2
Definition: ApiBase.php:79
User\getCanonicalName
static getCanonicalName( $name, $validate='valid')
Given unvalidated user input, return a canonical username, or false if the username is invalid.
Definition: User.php:883
ApiBase\PARAM_DFLT
const PARAM_DFLT
Definition: ApiBase.php:46
as
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
Definition: distributors.txt:9
ApiBase\getModuleName
getModuleName()
Get the name of the module being executed by this instance.
Definition: ApiBase.php:148
ApiBase\PARAM_ISMULTI
const PARAM_ISMULTI
Definition: ApiBase.php:48
ApiBase\PARAM_MAX2
const PARAM_MAX2
Definition: ApiBase.php:54
ApiQueryBase\addWhere
addWhere( $value)
Add a set of WHERE clauses to the internal array.
Definition: ApiQueryBase.php:152
ApiQueryBase\setContinueEnumParameter
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
Definition: ApiQueryBase.php:404
ApiBase\getRequireMaxOneParameterErrorMessages
getRequireMaxOneParameterErrorMessages( $params)
Generates the possible error requireMaxOneParameter() can die with.
Definition: ApiBase.php:791
$query
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1105
ApiBase\requireMaxOneParameter
requireMaxOneParameter( $params)
Die if more than one of a certain set of parameters is set and not false.
Definition: ApiBase.php:769
$res
$res
Definition: database.txt:21
ApiQueryBase\addWhereIf
addWhereIf( $value, $condition)
Same as addWhere(), but add the WHERE clauses only if a condition is met.
Definition: ApiQueryBase.php:170
$type
$type
Definition: testCompression.php:46
IP\formatHex
static formatHex( $hex)
Convert an IPv4 or IPv6 hexadecimal representation back to readable format.
Definition: IP.php:316