MediaWiki  master
ApiQueryLogEvents.php
Go to the documentation of this file.
1 <?php
25 
32 
33  private $commentStore;
34 
35  public function __construct( ApiQuery $query, $moduleName ) {
36  parent::__construct( $query, $moduleName, 'le' );
37  }
38 
39  private $fld_ids = false, $fld_title = false, $fld_type = false,
40  $fld_user = false, $fld_userid = false,
41  $fld_timestamp = false, $fld_comment = false, $fld_parsedcomment = false,
42  $fld_details = false, $fld_tags = false;
43 
44  public function execute() {
45  $params = $this->extractRequestParams();
46  $db = $this->getDB();
47  $this->commentStore = CommentStore::getStore();
48  $this->requireMaxOneParameter( $params, 'title', 'prefix', 'namespace' );
49 
50  $prop = array_flip( $params['prop'] );
51 
52  $this->fld_ids = isset( $prop['ids'] );
53  $this->fld_title = isset( $prop['title'] );
54  $this->fld_type = isset( $prop['type'] );
55  $this->fld_user = isset( $prop['user'] );
56  $this->fld_userid = isset( $prop['userid'] );
57  $this->fld_timestamp = isset( $prop['timestamp'] );
58  $this->fld_comment = isset( $prop['comment'] );
59  $this->fld_parsedcomment = isset( $prop['parsedcomment'] );
60  $this->fld_details = isset( $prop['details'] );
61  $this->fld_tags = isset( $prop['tags'] );
62 
63  $hideLogs = LogEventsList::getExcludeClause( $db, 'user', $this->getUser() );
64  if ( $hideLogs !== false ) {
65  $this->addWhere( $hideLogs );
66  }
67 
68  $actorMigration = ActorMigration::newMigration();
69  $actorQuery = $actorMigration->getJoin( 'log_user' );
70  $this->addTables( 'logging' );
71  $this->addTables( $actorQuery['tables'] );
72  $this->addTables( [ 'user', 'page' ] );
73  $this->addJoinConds( $actorQuery['joins'] );
74  $this->addJoinConds( [
75  'user' => [ 'LEFT JOIN',
76  'user_id=' . $actorQuery['fields']['log_user'] ],
77  'page' => [ 'LEFT JOIN',
78  [ 'log_namespace=page_namespace',
79  'log_title=page_title' ] ] ] );
80 
81  $this->addFields( [
82  'log_id',
83  'log_type',
84  'log_action',
85  'log_timestamp',
86  'log_deleted',
87  ] );
88 
89  $this->addFieldsIf( 'page_id', $this->fld_ids );
90  // log_page is the page_id saved at log time, whereas page_id is from a
91  // join at query time. This leads to different results in various
92  // scenarios, e.g. deletion, recreation.
93  $this->addFieldsIf( 'log_page', $this->fld_ids );
94  $this->addFieldsIf( $actorQuery['fields'] + [ 'user_name' ], $this->fld_user );
95  $this->addFieldsIf( $actorQuery['fields'], $this->fld_userid );
96  $this->addFieldsIf(
97  [ 'log_namespace', 'log_title' ],
98  $this->fld_title || $this->fld_parsedcomment
99  );
100  $this->addFieldsIf( 'log_params', $this->fld_details );
101 
102  if ( $this->fld_comment || $this->fld_parsedcomment ) {
103  $commentQuery = $this->commentStore->getJoin( 'log_comment' );
104  $this->addTables( $commentQuery['tables'] );
105  $this->addFields( $commentQuery['fields'] );
106  $this->addJoinConds( $commentQuery['joins'] );
107  }
108 
109  if ( $this->fld_tags ) {
110  $this->addFields( [ 'ts_tags' => ChangeTags::makeTagSummarySubquery( 'logging' ) ] );
111  }
112 
113  if ( !is_null( $params['tag'] ) ) {
114  $this->addTables( 'change_tag' );
115  $this->addJoinConds( [ 'change_tag' => [ 'JOIN',
116  [ 'log_id=ct_log_id' ] ] ] );
117  $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore();
118  try {
119  $this->addWhereFld( 'ct_tag_id', $changeTagDefStore->getId( $params['tag'] ) );
120  } catch ( NameTableAccessException $exception ) {
121  // Return nothing.
122  $this->addWhere( '1=0' );
123  }
124  }
125 
126  if ( !is_null( $params['action'] ) ) {
127  // Do validation of action param, list of allowed actions can contains wildcards
128  // Allow the param, when the actions is in the list or a wildcard version is listed.
129  $logAction = $params['action'];
130  if ( strpos( $logAction, '/' ) === false ) {
131  // all items in the list have a slash
132  $valid = false;
133  } else {
134  $logActions = array_flip( $this->getAllowedLogActions() );
135  list( $type, $action ) = explode( '/', $logAction, 2 );
136  $valid = isset( $logActions[$logAction] ) || isset( $logActions[$type . '/*'] );
137  }
138 
139  if ( !$valid ) {
140  $encParamName = $this->encodeParamName( 'action' );
141  $this->dieWithError(
142  [ 'apierror-unrecognizedvalue', $encParamName, wfEscapeWikiText( $logAction ) ],
143  "unknown_$encParamName"
144  );
145  }
146 
147  $this->addWhereFld( 'log_type', $type );
148  $this->addWhereFld( 'log_action', $action );
149  } elseif ( !is_null( $params['type'] ) ) {
150  $this->addWhereFld( 'log_type', $params['type'] );
151  }
152 
153  $this->addTimestampWhereRange(
154  'log_timestamp',
155  $params['dir'],
156  $params['start'],
157  $params['end']
158  );
159  // Include in ORDER BY for uniqueness
160  $this->addWhereRange( 'log_id', $params['dir'], null, null );
161 
162  if ( !is_null( $params['continue'] ) ) {
163  $cont = explode( '|', $params['continue'] );
164  $this->dieContinueUsageIf( count( $cont ) != 2 );
165  $op = ( $params['dir'] === 'newer' ? '>' : '<' );
166  $continueTimestamp = $db->addQuotes( $db->timestamp( $cont[0] ) );
167  $continueId = (int)$cont[1];
168  $this->dieContinueUsageIf( $continueId != $cont[1] );
169  $this->addWhere( "log_timestamp $op $continueTimestamp OR " .
170  "(log_timestamp = $continueTimestamp AND " .
171  "log_id $op= $continueId)"
172  );
173  }
174 
175  $limit = $params['limit'];
176  $this->addOption( 'LIMIT', $limit + 1 );
177 
178  $user = $params['user'];
179  if ( !is_null( $user ) ) {
180  // Note the joins in $q are the same as those from ->getJoin() above
181  // so we only need to add 'conds' here.
182  $q = $actorMigration->getWhere(
183  $db, 'log_user', User::newFromName( $params['user'], false )
184  );
185  $this->addWhere( $q['conds'] );
186 
187  // T71222: MariaDB's optimizer, at least 10.1.37 and .38, likes to choose a wildly bad plan for
188  // some reason for this code path. Tell it not to use the wrong index it wants to pick.
189  $this->addOption( 'IGNORE INDEX', [ 'logging' => [ 'times' ] ] );
190  }
191 
192  $title = $params['title'];
193  if ( !is_null( $title ) ) {
194  $titleObj = Title::newFromText( $title );
195  if ( is_null( $titleObj ) ) {
196  $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $title ) ] );
197  }
198  $this->addWhereFld( 'log_namespace', $titleObj->getNamespace() );
199  $this->addWhereFld( 'log_title', $titleObj->getDBkey() );
200  }
201 
202  if ( $params['namespace'] !== null ) {
203  $this->addWhereFld( 'log_namespace', $params['namespace'] );
204  }
205 
206  $prefix = $params['prefix'];
207 
208  if ( !is_null( $prefix ) ) {
209  if ( $this->getConfig()->get( 'MiserMode' ) ) {
210  $this->dieWithError( 'apierror-prefixsearchdisabled' );
211  }
212 
213  $title = Title::newFromText( $prefix );
214  if ( is_null( $title ) ) {
215  $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $prefix ) ] );
216  }
217  $this->addWhereFld( 'log_namespace', $title->getNamespace() );
218  $this->addWhere( 'log_title ' . $db->buildLike( $title->getDBkey(), $db->anyString() ) );
219  }
220 
221  // Paranoia: avoid brute force searches (T19342)
222  if ( $params['namespace'] !== null || !is_null( $title ) || !is_null( $user ) ) {
223  if ( !$this->getUser()->isAllowed( 'deletedhistory' ) ) {
224  $titleBits = LogPage::DELETED_ACTION;
225  $userBits = LogPage::DELETED_USER;
226  } elseif ( !$this->getUser()->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
229  } else {
230  $titleBits = 0;
231  $userBits = 0;
232  }
233  if ( ( $params['namespace'] !== null || !is_null( $title ) ) && $titleBits ) {
234  $this->addWhere( $db->bitAnd( 'log_deleted', $titleBits ) . " != $titleBits" );
235  }
236  if ( !is_null( $user ) && $userBits ) {
237  $this->addWhere( $db->bitAnd( 'log_deleted', $userBits ) . " != $userBits" );
238  }
239  }
240 
241  // T220999: MySQL/MariaDB (10.1.37) can sometimes irrationally decide that querying `actor` before
242  // `logging` and filesorting is somehow better than querying $limit+1 rows from `logging`.
243  // Tell it not to reorder the query. But not when `letag` was used, as it seems as likely
244  // to be harmed as helped in that case.
245  if ( $params['tag'] === null ) {
246  $this->addOption( 'STRAIGHT_JOIN' );
247  }
248 
249  $count = 0;
250  $res = $this->select( __METHOD__ );
251  $result = $this->getResult();
252  foreach ( $res as $row ) {
253  if ( ++$count > $limit ) {
254  // We've reached the one extra which shows that there are
255  // additional pages to be had. Stop here...
256  $this->setContinueEnumParameter( 'continue', "$row->log_timestamp|$row->log_id" );
257  break;
258  }
259 
260  $vals = $this->extractRowInfo( $row );
261  $fit = $result->addValue( [ 'query', $this->getModuleName() ], null, $vals );
262  if ( !$fit ) {
263  $this->setContinueEnumParameter( 'continue', "$row->log_timestamp|$row->log_id" );
264  break;
265  }
266  }
267  $result->addIndexedTagName( [ 'query', $this->getModuleName() ], 'item' );
268  }
269 
270  private function extractRowInfo( $row ) {
271  $logEntry = DatabaseLogEntry::newFromRow( $row );
272  $vals = [
273  ApiResult::META_TYPE => 'assoc',
274  ];
275  $anyHidden = false;
276  $user = $this->getUser();
277 
278  if ( $this->fld_ids ) {
279  $vals['logid'] = (int)$row->log_id;
280  }
281 
282  if ( $this->fld_title || $this->fld_parsedcomment ) {
283  $title = Title::makeTitle( $row->log_namespace, $row->log_title );
284  }
285 
286  if ( $this->fld_title || $this->fld_ids || $this->fld_details && $row->log_params !== '' ) {
288  $vals['actionhidden'] = true;
289  $anyHidden = true;
290  }
292  if ( $this->fld_title ) {
294  }
295  if ( $this->fld_ids ) {
296  $vals['pageid'] = (int)$row->page_id;
297  $vals['logpage'] = (int)$row->log_page;
298  }
299  if ( $this->fld_details ) {
300  $vals['params'] = LogFormatter::newFromEntry( $logEntry )->formatParametersForApi();
301  }
302  }
303  }
304 
305  if ( $this->fld_type ) {
306  $vals['type'] = $row->log_type;
307  $vals['action'] = $row->log_action;
308  }
309 
310  if ( $this->fld_user || $this->fld_userid ) {
312  $vals['userhidden'] = true;
313  $anyHidden = true;
314  }
316  if ( $this->fld_user ) {
317  $vals['user'] = $row->user_name ?? $row->log_user_text;
318  }
319  if ( $this->fld_userid ) {
320  $vals['userid'] = (int)$row->log_user;
321  }
322 
323  if ( !$row->log_user ) {
324  $vals['anon'] = true;
325  }
326  }
327  }
328  if ( $this->fld_timestamp ) {
329  $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->log_timestamp );
330  }
331 
332  if ( $this->fld_comment || $this->fld_parsedcomment ) {
334  $vals['commenthidden'] = true;
335  $anyHidden = true;
336  }
338  $comment = $this->commentStore->getComment( 'log_comment', $row )->text;
339  if ( $this->fld_comment ) {
340  $vals['comment'] = $comment;
341  }
342 
343  if ( $this->fld_parsedcomment ) {
344  $vals['parsedcomment'] = Linker::formatComment( $comment, $title );
345  }
346  }
347  }
348 
349  if ( $this->fld_tags ) {
350  if ( $row->ts_tags ) {
351  $tags = explode( ',', $row->ts_tags );
352  ApiResult::setIndexedTagName( $tags, 'tag' );
353  $vals['tags'] = $tags;
354  } else {
355  $vals['tags'] = [];
356  }
357  }
358 
359  if ( $anyHidden && LogEventsList::isDeleted( $row, LogPage::DELETED_RESTRICTED ) ) {
360  $vals['suppressed'] = true;
361  }
362 
363  return $vals;
364  }
365 
369  private function getAllowedLogActions() {
370  $config = $this->getConfig();
371  return array_keys( array_merge(
372  $config->get( 'LogActions' ),
373  $config->get( 'LogActionsHandlers' )
374  ) );
375  }
376 
377  public function getCacheMode( $params ) {
378  if ( $this->userCanSeeRevDel() ) {
379  return 'private';
380  }
381  if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) {
382  // formatComment() calls wfMessage() among other things
383  return 'anon-public-user-private';
384  } elseif ( LogEventsList::getExcludeClause( $this->getDB(), 'user', $this->getUser() )
385  === LogEventsList::getExcludeClause( $this->getDB(), 'public' )
386  ) { // Output can only contain public data.
387  return 'public';
388  } else {
389  return 'anon-public-user-private';
390  }
391  }
392 
393  public function getAllowedParams( $flags = 0 ) {
394  $config = $this->getConfig();
395  if ( $flags & ApiBase::GET_VALUES_FOR_HELP ) {
396  $logActions = $this->getAllowedLogActions();
397  sort( $logActions );
398  } else {
399  $logActions = null;
400  }
401  $ret = [
402  'prop' => [
403  ApiBase::PARAM_ISMULTI => true,
404  ApiBase::PARAM_DFLT => 'ids|title|type|user|timestamp|comment|details',
406  'ids',
407  'title',
408  'type',
409  'user',
410  'userid',
411  'timestamp',
412  'comment',
413  'parsedcomment',
414  'details',
415  'tags'
416  ],
418  ],
419  'type' => [
421  ],
422  'action' => [
423  // validation on request is done in execute()
424  ApiBase::PARAM_TYPE => $logActions
425  ],
426  'start' => [
427  ApiBase::PARAM_TYPE => 'timestamp'
428  ],
429  'end' => [
430  ApiBase::PARAM_TYPE => 'timestamp'
431  ],
432  'dir' => [
433  ApiBase::PARAM_DFLT => 'older',
435  'newer',
436  'older'
437  ],
438  ApiBase::PARAM_HELP_MSG => 'api-help-param-direction',
439  ],
440  'user' => [
441  ApiBase::PARAM_TYPE => 'user',
442  ],
443  'title' => null,
444  'namespace' => [
445  ApiBase::PARAM_TYPE => 'namespace',
447  ],
448  'prefix' => [],
449  'tag' => null,
450  'limit' => [
451  ApiBase::PARAM_DFLT => 10,
452  ApiBase::PARAM_TYPE => 'limit',
453  ApiBase::PARAM_MIN => 1,
456  ],
457  'continue' => [
458  ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
459  ],
460  ];
461 
462  if ( $config->get( 'MiserMode' ) ) {
463  $ret['prefix'][ApiBase::PARAM_HELP_MSG] = 'api-help-param-disabled-in-miser-mode';
464  }
465 
466  return $ret;
467  }
468 
469  protected function getExamplesMessages() {
470  return [
471  'action=query&list=logevents'
472  => 'apihelp-query+logevents-example-simple',
473  ];
474  }
475 
476  public function getHelpUrls() {
477  return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Logevents';
478  }
479 }
select( $method, $extraQuery=[], array &$hookData=null)
Execute a SELECT query based on the values in the internal arrays.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below...
Definition: ApiBase.php:94
getDB()
Get the Query database connection (read-only)
const LIMIT_BIG2
Fast query, apihighlimits limit.
Definition: ApiBase.php:261
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
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc.
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1585
getResult()
Get the result object.
Definition: ApiBase.php:639
addJoinConds( $join_conds)
Add a set of JOIN conditions to the internal array.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
Definition: hooks.txt:1982
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
Definition: ApiBase.php:55
const GET_VALUES_FOR_HELP
getAllowedParams() flag: When set, the result could take longer to generate, but should be more thoro...
Definition: ApiBase.php:272
const LIMIT_BIG1
Fast query, standard limit.
Definition: ApiBase.php:259
static newFromRow( $row)
Constructs new LogEntry from database result row.
Exception representing a failure to look up a row from a name table.
static newFromEntry(LogEntry $entry)
Constructs a new formatter suitable for given entry.
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE &#39;integer&#39; and &#39;limit&#39;.
Definition: ApiBase.php:97
This is a base class for all Query modules.
const NS_SPECIAL
Definition: Defines.php:49
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
Definition: ApiBase.php:2008
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user...
Definition: ApiBase.php:760
const META_TYPE
Key for the &#39;type&#39; metadata item.
Definition: ApiResult.php:110
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
Definition: injection.txt:23
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
Definition: ApiBase.php:164
__construct(ApiQuery $query, $moduleName)
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:616
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. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. '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 '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 '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 '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. '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 IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() '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 Sanitizer::validateEmail(), 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 '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:Array with elements of the form "language:title" in the order that they will be output. & $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. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead. 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:1980
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
const DELETED_COMMENT
Definition: LogPage.php:35
static newMigration()
Static constructor.
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
static formatComment( $comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
Definition: Linker.php:1160
userCanSeeRevDel()
Check whether the current user has permission to view revision-deleted fields.
const NS_MEDIA
Definition: Defines.php:48
$res
Definition: database.txt:21
dieContinueUsageIf( $condition)
Die with the &#39;badcontinue&#39; error.
Definition: ApiBase.php:2199
$params
static isDeleted( $row, $field)
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
Definition: hooks.txt:780
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:925
getModuleName()
Get the name of the module being executed by this instance.
Definition: ApiBase.php:519
addFields( $value)
Add a set of fields to select to the internal array.
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right, for PARAM_TYPE &#39;limit&#39;.
Definition: ApiBase.php:103
This is the main query class.
Definition: ApiQuery.php:36
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
requireMaxOneParameter( $params, $required)
Die if more than one of a certain set of parameters is set and not false.
Definition: ApiBase.php:930
const DELETED_RESTRICTED
Definition: LogPage.php:37
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter...
Definition: ApiBase.php:131
const DELETED_USER
Definition: LogPage.php:36
addTimestampWhereRange( $field, $dir, $start, $end, $sort=true)
Add a WHERE clause corresponding to a range, similar to addWhereRange, but converts $start and $end t...
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:589
encodeParamName( $paramName)
This method mangles parameter name based on the prefix supplied to the constructor.
Definition: ApiBase.php:738
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
Definition: injection.txt:35
static getStore()
static userCan( $row, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row, if it&#39;s marked as deleted and/or restricted log type.
addWhere( $value)
Add a set of WHERE clauses to the internal array.
static getExcludeClause( $db, $audience='public', User $user=null)
SQL clause to skip forbidden log types for this user.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Definition: ApiBase.php:58
addWhereFld( $field, $value)
Equivalent to addWhere( [ $field => $value ] )
Query action to List the log events, with optional filtering by various parameters.
addFieldsIf( $value, $condition)
Same as addFields(), but add the fields only if a condition is met.
const PARAM_EXTRA_NAMESPACES
(int[]) When PARAM_TYPE is &#39;namespace&#39;, include these as additional possible values.
Definition: ApiBase.php:193
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
const DELETED_ACTION
Definition: LogPage.php:34
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE &#39;integer&#39; and &#39;limit&#39;.
Definition: ApiBase.php:106
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:594
static makeTagSummarySubquery( $tables)
Make the tag summary subquery based on the given tables and return it.
Definition: ChangeTags.php:797
static validTypes()
Get the list of valid log types.
Definition: LogPage.php:198
return true to allow those checks to and false if checking is done & $user
Definition: hooks.txt:1473
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:319
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...
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.