MediaWiki  1.23.2
ApiQueryLogEvents.php
Go to the documentation of this file.
1 <?php
33 
34  public function __construct( $query, $moduleName ) {
35  parent::__construct( $query, $moduleName, 'le' );
36  }
37 
38  private $fld_ids = false, $fld_title = false, $fld_type = false,
39  $fld_action = false, $fld_user = false, $fld_userid = false,
40  $fld_timestamp = false, $fld_comment = false, $fld_parsedcomment = false,
41  $fld_details = false, $fld_tags = false;
42 
43  public function execute() {
44  $params = $this->extractRequestParams();
45  $db = $this->getDB();
46 
47  $prop = array_flip( $params['prop'] );
48 
49  $this->fld_ids = isset( $prop['ids'] );
50  $this->fld_title = isset( $prop['title'] );
51  $this->fld_type = isset( $prop['type'] );
52  $this->fld_action = isset( $prop['action'] );
53  $this->fld_user = isset( $prop['user'] );
54  $this->fld_userid = isset( $prop['userid'] );
55  $this->fld_timestamp = isset( $prop['timestamp'] );
56  $this->fld_comment = isset( $prop['comment'] );
57  $this->fld_parsedcomment = isset( $prop['parsedcomment'] );
58  $this->fld_details = isset( $prop['details'] );
59  $this->fld_tags = isset( $prop['tags'] );
60 
61  $hideLogs = LogEventsList::getExcludeClause( $db, 'user', $this->getUser() );
62  if ( $hideLogs !== false ) {
63  $this->addWhere( $hideLogs );
64  }
65 
66  // Order is significant here
67  $this->addTables( array( 'logging', 'user', 'page' ) );
68  $this->addJoinConds( array(
69  'user' => array( 'LEFT JOIN',
70  'user_id=log_user' ),
71  'page' => array( 'LEFT JOIN',
72  array( 'log_namespace=page_namespace',
73  'log_title=page_title' ) ) ) );
74 
75  $this->addFields( array(
76  'log_id',
77  'log_type',
78  'log_action',
79  'log_timestamp',
80  'log_deleted',
81  ) );
82 
83  $this->addFieldsIf( 'page_id', $this->fld_ids );
84  $this->addFieldsIf( array( 'log_user', 'log_user_text', 'user_name' ), $this->fld_user );
85  $this->addFieldsIf( 'log_user', $this->fld_userid );
86  $this->addFieldsIf(
87  array( 'log_namespace', 'log_title' ),
88  $this->fld_title || $this->fld_parsedcomment
89  );
90  $this->addFieldsIf( 'log_comment', $this->fld_comment || $this->fld_parsedcomment );
91  $this->addFieldsIf( 'log_params', $this->fld_details );
92 
93  if ( $this->fld_tags ) {
94  $this->addTables( 'tag_summary' );
95  $this->addJoinConds( array( 'tag_summary' => array( 'LEFT JOIN', 'log_id=ts_log_id' ) ) );
96  $this->addFields( 'ts_tags' );
97  }
98 
99  if ( !is_null( $params['tag'] ) ) {
100  $this->addTables( 'change_tag' );
101  $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN',
102  array( 'log_id=ct_log_id' ) ) ) );
103  $this->addWhereFld( 'ct_tag', $params['tag'] );
104  }
105 
106  if ( !is_null( $params['action'] ) ) {
107  // Do validation of action param, list of allowed actions can contains wildcards
108  // Allow the param, when the actions is in the list or a wildcard version is listed.
109  $logAction = $params['action'];
110  if ( strpos( $logAction, '/' ) === false ) {
111  // all items in the list have a slash
112  $valid = false;
113  } else {
114  $logActions = array_flip( $this->getAllowedLogActions() );
115  list( $type, $action ) = explode( '/', $logAction, 2 );
116  $valid = isset( $logActions[$logAction] ) || isset( $logActions[$type . '/*'] );
117  }
118 
119  if ( !$valid ) {
120  $valueName = $this->encodeParamName( 'action' );
121  $this->dieUsage(
122  "Unrecognized value for parameter '$valueName': {$logAction}",
123  "unknown_$valueName"
124  );
125  }
126 
127  $this->addWhereFld( 'log_type', $type );
128  $this->addWhereFld( 'log_action', $action );
129  } elseif ( !is_null( $params['type'] ) ) {
130  $this->addWhereFld( 'log_type', $params['type'] );
131  }
132 
133  $this->addTimestampWhereRange(
134  'log_timestamp',
135  $params['dir'],
136  $params['start'],
137  $params['end']
138  );
139  // Include in ORDER BY for uniqueness
140  $this->addWhereRange( 'log_id', $params['dir'], null, null );
141 
142  if ( !is_null( $params['continue'] ) ) {
143  $cont = explode( '|', $params['continue'] );
144  $this->dieContinueUsageIf( count( $cont ) != 2 );
145  $op = ( $params['dir'] === 'newer' ? '>' : '<' );
146  $continueTimestamp = $db->addQuotes( $db->timestamp( $cont[0] ) );
147  $continueId = (int)$cont[1];
148  $this->dieContinueUsageIf( $continueId != $cont[1] );
149  $this->addWhere( "log_timestamp $op $continueTimestamp OR " .
150  "(log_timestamp = $continueTimestamp AND " .
151  "log_id $op= $continueId)"
152  );
153  }
154 
155  $limit = $params['limit'];
156  $this->addOption( 'LIMIT', $limit + 1 );
157 
158  $user = $params['user'];
159  if ( !is_null( $user ) ) {
160  $userid = User::idFromName( $user );
161  if ( $userid ) {
162  $this->addWhereFld( 'log_user', $userid );
163  } else {
164  $this->addWhereFld( 'log_user_text', IP::sanitizeIP( $user ) );
165  }
166  }
167 
168  $title = $params['title'];
169  if ( !is_null( $title ) ) {
170  $titleObj = Title::newFromText( $title );
171  if ( is_null( $titleObj ) ) {
172  $this->dieUsage( "Bad title value '$title'", 'param_title' );
173  }
174  $this->addWhereFld( 'log_namespace', $titleObj->getNamespace() );
175  $this->addWhereFld( 'log_title', $titleObj->getDBkey() );
176  }
177 
178  $prefix = $params['prefix'];
179 
180  if ( !is_null( $prefix ) ) {
181  global $wgMiserMode;
182  if ( $wgMiserMode ) {
183  $this->dieUsage( 'Prefix search disabled in Miser Mode', 'prefixsearchdisabled' );
184  }
185 
186  $title = Title::newFromText( $prefix );
187  if ( is_null( $title ) ) {
188  $this->dieUsage( "Bad title value '$prefix'", 'param_prefix' );
189  }
190  $this->addWhereFld( 'log_namespace', $title->getNamespace() );
191  $this->addWhere( 'log_title ' . $db->buildLike( $title->getDBkey(), $db->anyString() ) );
192  }
193 
194  // Paranoia: avoid brute force searches (bug 17342)
195  if ( !is_null( $title ) || !is_null( $user ) ) {
196  if ( !$this->getUser()->isAllowed( 'deletedhistory' ) ) {
197  $titleBits = LogPage::DELETED_ACTION;
198  $userBits = LogPage::DELETED_USER;
199  } elseif ( !$this->getUser()->isAllowed( 'suppressrevision' ) ) {
202  } else {
203  $titleBits = 0;
204  $userBits = 0;
205  }
206  if ( !is_null( $title ) && $titleBits ) {
207  $this->addWhere( $db->bitAnd( 'log_deleted', $titleBits ) . " != $titleBits" );
208  }
209  if ( !is_null( $user ) && $userBits ) {
210  $this->addWhere( $db->bitAnd( 'log_deleted', $userBits ) . " != $userBits" );
211  }
212  }
213 
214  $count = 0;
215  $res = $this->select( __METHOD__ );
216  $result = $this->getResult();
217  foreach ( $res as $row ) {
218  if ( ++$count > $limit ) {
219  // We've reached the one extra which shows that there are
220  // additional pages to be had. Stop here...
221  $this->setContinueEnumParameter( 'continue', "$row->log_timestamp|$row->log_id" );
222  break;
223  }
224 
225  $vals = $this->extractRowInfo( $row );
226  if ( !$vals ) {
227  continue;
228  }
229  $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals );
230  if ( !$fit ) {
231  $this->setContinueEnumParameter( 'continue', "$row->log_timestamp|$row->log_id" );
232  break;
233  }
234  }
235  $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'item' );
236  }
237 
248  public static function addLogParams( $result, &$vals, $params, $type,
249  $action, $ts, $legacy = false
250  ) {
251  switch ( $type ) {
252  case 'move':
253  if ( $legacy ) {
254  $targetKey = 0;
255  $noredirKey = 1;
256  } else {
257  $targetKey = '4::target';
258  $noredirKey = '5::noredir';
259  }
260 
261  if ( isset( $params[$targetKey] ) ) {
262  $title = Title::newFromText( $params[$targetKey] );
263  if ( $title ) {
264  $vals2 = array();
265  ApiQueryBase::addTitleInfo( $vals2, $title, 'new_' );
266  $vals[$type] = $vals2;
267  }
268  }
269  if ( isset( $params[$noredirKey] ) && $params[$noredirKey] ) {
270  $vals[$type]['suppressedredirect'] = '';
271  }
272  $params = null;
273  break;
274  case 'patrol':
275  if ( $legacy ) {
276  $cur = 0;
277  $prev = 1;
278  $auto = 2;
279  } else {
280  $cur = '4::curid';
281  $prev = '5::previd';
282  $auto = '6::auto';
283  }
284  $vals2 = array();
285  $vals2['cur'] = $params[$cur];
286  $vals2['prev'] = $params[$prev];
287  $vals2['auto'] = $params[$auto];
288  $vals[$type] = $vals2;
289  $params = null;
290  break;
291  case 'rights':
292  $vals2 = array();
293  if ( $legacy ) {
294  list( $vals2['old'], $vals2['new'] ) = $params;
295  } else {
296  $vals2['new'] = implode( ', ', $params['5::newgroups'] );
297  $vals2['old'] = implode( ', ', $params['4::oldgroups'] );
298  }
299  $vals[$type] = $vals2;
300  $params = null;
301  break;
302  case 'block':
303  if ( $action == 'unblock' ) {
304  break;
305  }
306  $vals2 = array();
307  list( $vals2['duration'], $vals2['flags'] ) = $params;
308 
309  // Indefinite blocks have no expiry time
310  if ( SpecialBlock::parseExpiryInput( $params[0] ) !== wfGetDB( DB_SLAVE )->getInfinity() ) {
311  $vals2['expiry'] = wfTimestamp( TS_ISO_8601,
312  strtotime( $params[0], wfTimestamp( TS_UNIX, $ts ) ) );
313  }
314  $vals[$type] = $vals2;
315  $params = null;
316  break;
317  case 'upload':
318  if ( isset( $params['img_timestamp'] ) ) {
319  $params['img_timestamp'] = wfTimestamp( TS_ISO_8601, $params['img_timestamp'] );
320  }
321  break;
322  }
323  if ( !is_null( $params ) ) {
324  $logParams = array();
325  // Keys like "4::paramname" can't be used for output so we change them to "paramname"
326  foreach ( $params as $key => $value ) {
327  if ( strpos( $key, ':' ) === false ) {
328  $logParams[$key] = $value;
329  continue;
330  }
331  $logParam = explode( ':', $key, 3 );
332  $logParams[$logParam[2]] = $value;
333  }
334  $result->setIndexedTagName( $logParams, 'param' );
335  $result->setIndexedTagName_recursive( $logParams, 'param' );
336  $vals = array_merge( $vals, $logParams );
337  }
338 
339  return $vals;
340  }
341 
342  private function extractRowInfo( $row ) {
343  $logEntry = DatabaseLogEntry::newFromRow( $row );
344  $vals = array();
345  $anyHidden = false;
346  $user = $this->getUser();
347 
348  if ( $this->fld_ids ) {
349  $vals['logid'] = intval( $row->log_id );
350  }
351 
352  if ( $this->fld_title || $this->fld_parsedcomment ) {
353  $title = Title::makeTitle( $row->log_namespace, $row->log_title );
354  }
355 
356  if ( $this->fld_title || $this->fld_ids || $this->fld_details && $row->log_params !== '' ) {
358  $vals['actionhidden'] = '';
359  $anyHidden = true;
360  }
362  if ( $this->fld_title ) {
364  }
365  if ( $this->fld_ids ) {
366  $vals['pageid'] = intval( $row->page_id );
367  }
368  if ( $this->fld_details && $row->log_params !== '' ) {
370  $this->getResult(),
371  $vals,
372  $logEntry->getParameters(),
373  $logEntry->getType(),
374  $logEntry->getSubtype(),
375  $logEntry->getTimestamp(),
376  $logEntry->isLegacy()
377  );
378  }
379  }
380  }
381 
382  if ( $this->fld_type || $this->fld_action ) {
383  $vals['type'] = $row->log_type;
384  $vals['action'] = $row->log_action;
385  }
386 
387  if ( $this->fld_user || $this->fld_userid ) {
389  $vals['userhidden'] = '';
390  $anyHidden = true;
391  }
393  if ( $this->fld_user ) {
394  $vals['user'] = $row->user_name === null ? $row->log_user_text : $row->user_name;
395  }
396  if ( $this->fld_userid ) {
397  $vals['userid'] = $row->log_user;
398  }
399 
400  if ( !$row->log_user ) {
401  $vals['anon'] = '';
402  }
403  }
404  }
405  if ( $this->fld_timestamp ) {
406  $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->log_timestamp );
407  }
408 
409  if ( ( $this->fld_comment || $this->fld_parsedcomment ) && isset( $row->log_comment ) ) {
411  $vals['commenthidden'] = '';
412  $anyHidden = true;
413  }
415  if ( $this->fld_comment ) {
416  $vals['comment'] = $row->log_comment;
417  }
418 
419  if ( $this->fld_parsedcomment ) {
420  $vals['parsedcomment'] = Linker::formatComment( $row->log_comment, $title );
421  }
422  }
423  }
424 
425  if ( $this->fld_tags ) {
426  if ( $row->ts_tags ) {
427  $tags = explode( ',', $row->ts_tags );
428  $this->getResult()->setIndexedTagName( $tags, 'tag' );
429  $vals['tags'] = $tags;
430  } else {
431  $vals['tags'] = array();
432  }
433  }
434 
435  if ( $anyHidden && LogEventsList::isDeleted( $row, LogPage::DELETED_RESTRICTED ) ) {
436  $vals['suppressed'] = '';
437  }
438 
439  return $vals;
440  }
441 
442  private function getAllowedLogActions() {
443  global $wgLogActions, $wgLogActionsHandlers;
444 
445  return array_keys( array_merge( $wgLogActions, $wgLogActionsHandlers ) );
446  }
447 
448  public function getCacheMode( $params ) {
449  if ( $this->userCanSeeRevDel() ) {
450  return 'private';
451  }
452  if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) {
453  // formatComment() calls wfMessage() among other things
454  return 'anon-public-user-private';
455  } elseif ( LogEventsList::getExcludeClause( $this->getDB(), 'user', $this->getUser() )
456  === LogEventsList::getExcludeClause( $this->getDB(), 'public' )
457  ) { // Output can only contain public data.
458  return 'public';
459  } else {
460  return 'anon-public-user-private';
461  }
462  }
463 
464  public function getAllowedParams( $flags = 0 ) {
465  global $wgLogTypes;
466 
467  return array(
468  'prop' => array(
469  ApiBase::PARAM_ISMULTI => true,
470  ApiBase::PARAM_DFLT => 'ids|title|type|user|timestamp|comment|details',
472  'ids',
473  'title',
474  'type',
475  'user',
476  'userid',
477  'timestamp',
478  'comment',
479  'parsedcomment',
480  'details',
481  'tags'
482  )
483  ),
484  'type' => array(
485  ApiBase::PARAM_TYPE => $wgLogTypes
486  ),
487  'action' => array(
488  // validation on request is done in execute()
490  ? $this->getAllowedLogActions()
491  : null
492  ),
493  'start' => array(
494  ApiBase::PARAM_TYPE => 'timestamp'
495  ),
496  'end' => array(
497  ApiBase::PARAM_TYPE => 'timestamp'
498  ),
499  'dir' => array(
500  ApiBase::PARAM_DFLT => 'older',
502  'newer',
503  'older'
504  )
505  ),
506  'user' => null,
507  'title' => null,
508  'prefix' => null,
509  'tag' => null,
510  'limit' => array(
511  ApiBase::PARAM_DFLT => 10,
512  ApiBase::PARAM_TYPE => 'limit',
513  ApiBase::PARAM_MIN => 1,
516  ),
517  'continue' => null,
518  );
519  }
520 
521  public function getParamDescription() {
522  $p = $this->getModulePrefix();
523 
524  return array(
525  'prop' => array(
526  'Which properties to get',
527  ' ids - Adds the ID of the log event',
528  ' title - Adds the title of the page for the log event',
529  ' type - Adds the type of log event',
530  ' user - Adds the user responsible for the log event',
531  ' userid - Adds the user ID who was responsible for the log event',
532  ' timestamp - Adds the timestamp for the event',
533  ' comment - Adds the comment of the event',
534  ' parsedcomment - Adds the parsed comment of the event',
535  ' details - Lists additional details about the event',
536  ' tags - Lists tags for the event',
537  ),
538  'type' => 'Filter log entries to only this type',
539  'action' => array(
540  "Filter log actions to only this action. Overrides {$p}type",
541  "Wildcard actions like 'action/*' allows to specify any string for the asterisk"
542  ),
543  'start' => 'The timestamp to start enumerating from',
544  'end' => 'The timestamp to end enumerating',
545  'dir' => $this->getDirectionDescription( $p ),
546  'user' => 'Filter entries to those made by the given user',
547  'title' => 'Filter entries to those related to a page',
548  'prefix' => 'Filter entries that start with this prefix. Disabled in Miser Mode',
549  'limit' => 'How many total event entries to return',
550  'tag' => 'Only list event entries tagged with this tag',
551  'continue' => 'When more results are available, use this to continue',
552  );
553  }
554 
555  public function getResultProperties() {
556  global $wgLogTypes;
557 
558  return array(
559  'ids' => array(
560  'logid' => 'integer',
561  'pageid' => 'integer'
562  ),
563  'title' => array(
564  'ns' => 'namespace',
565  'title' => 'string'
566  ),
567  'type' => array(
568  'type' => array(
569  ApiBase::PROP_TYPE => $wgLogTypes
570  ),
571  'action' => 'string'
572  ),
573  'details' => array(
574  'actionhidden' => 'boolean'
575  ),
576  'user' => array(
577  'userhidden' => 'boolean',
578  'user' => array(
579  ApiBase::PROP_TYPE => 'string',
580  ApiBase::PROP_NULLABLE => true
581  ),
582  'anon' => 'boolean'
583  ),
584  'userid' => array(
585  'userhidden' => 'boolean',
586  'userid' => array(
587  ApiBase::PROP_TYPE => 'integer',
588  ApiBase::PROP_NULLABLE => true
589  ),
590  'anon' => 'boolean'
591  ),
592  'timestamp' => array(
593  'timestamp' => 'timestamp'
594  ),
595  'comment' => array(
596  'commenthidden' => 'boolean',
597  'comment' => array(
598  ApiBase::PROP_TYPE => 'string',
599  ApiBase::PROP_NULLABLE => true
600  )
601  ),
602  'parsedcomment' => array(
603  'commenthidden' => 'boolean',
604  'parsedcomment' => array(
605  ApiBase::PROP_TYPE => 'string',
606  ApiBase::PROP_NULLABLE => true
607  )
608  )
609  );
610  }
611 
612  public function getDescription() {
613  return 'Get events from logs.';
614  }
615 
616  public function getPossibleErrors() {
617  return array_merge( parent::getPossibleErrors(), array(
618  array( 'code' => 'param_user', 'info' => 'User name $user not found' ),
619  array( 'code' => 'param_title', 'info' => 'Bad title value \'title\'' ),
620  array( 'code' => 'param_prefix', 'info' => 'Bad title value \'prefix\'' ),
621  array( 'code' => 'prefixsearchdisabled', 'info' => 'Prefix search disabled in Miser Mode' ),
622  ) );
623  }
624 
625  public function getExamples() {
626  return array(
627  'api.php?action=query&list=logevents'
628  );
629  }
630 
631  public function getHelpUrls() {
632  return 'https://www.mediawiki.org/wiki/API:Logevents';
633  }
634 }
Title\makeTitle
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:398
$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
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:189
ApiQueryBase\addFields
addFields( $value)
Add a set of fields to select to the internal array.
Definition: ApiQueryBase.php:117
ApiQueryLogEvents\getDescription
getDescription()
Returns the description string for this module.
Definition: ApiQueryLogEvents.php:612
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
ApiQueryLogEvents\addLogParams
static addLogParams( $result, &$vals, $params, $type, $action, $ts, $legacy=false)
Definition: ApiQueryLogEvents.php:248
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3650
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
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
ApiQueryLogEvents\$fld_comment
$fld_comment
Definition: ApiQueryLogEvents.php:40
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
$limit
if( $sleep) $limit
Definition: importImages.php:99
ApiQueryLogEvents\$fld_userid
$fld_userid
Definition: ApiQueryLogEvents.php:39
ApiQueryBase\addOption
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
Definition: ApiQueryBase.php:252
Linker\formatComment
static formatComment( $comment, $title=null, $local=false)
This function is called by all recent changes variants, by the page history, and by the user contribu...
Definition: Linker.php:1254
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2113
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:132
ApiQueryLogEvents\$fld_timestamp
$fld_timestamp
Definition: ApiQueryLogEvents.php:40
ApiQueryLogEvents
Query action to List the log events, with optional filtering by various parameters.
Definition: ApiQueryLogEvents.php:32
ApiQueryBase\addFieldsIf
addFieldsIf( $value, $condition)
Same as addFields(), but add the fields only if a condition is met.
Definition: ApiQueryBase.php:131
ApiQueryLogEvents\getPossibleErrors
getPossibleErrors()
Definition: ApiQueryLogEvents.php:616
ApiBase\PARAM_MIN
const PARAM_MIN
Definition: ApiBase.php:56
ApiQueryLogEvents\$fld_details
$fld_details
Definition: ApiQueryLogEvents.php:41
DatabaseLogEntry\newFromRow
static newFromRow( $row)
Constructs new LogEntry from database result row.
Definition: LogEntry.php:163
LogPage\DELETED_COMMENT
const DELETED_COMMENT
Definition: LogPage.php:34
ApiQueryLogEvents\getAllowedParams
getAllowedParams( $flags=0)
Definition: ApiQueryLogEvents.php:464
LogPage\DELETED_USER
const DELETED_USER
Definition: LogPage.php:35
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
ApiQueryBase\getDB
getDB()
Get the Query database connection (read-only)
Definition: ApiQueryBase.php:417
ApiBase\PARAM_MAX
const PARAM_MAX
Definition: ApiBase.php:52
ApiQueryBase\addTables
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
Definition: ApiQueryBase.php:82
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
ApiQueryLogEvents\$fld_type
$fld_type
Definition: ApiQueryLogEvents.php:38
ApiBase\PROP_TYPE
const PROP_TYPE
Definition: ApiBase.php:74
ApiQueryLogEvents\getHelpUrls
getHelpUrls()
Definition: ApiQueryLogEvents.php:631
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
LogPage\DELETED_ACTION
const DELETED_ACTION
Definition: LogPage.php:33
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
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
$value
$value
Definition: styleTest.css.php:45
ApiQueryLogEvents\$fld_title
$fld_title
Definition: ApiQueryLogEvents.php:38
ApiBase\dieContinueUsageIf
dieContinueUsageIf( $condition)
Die with the $prefix.
Definition: ApiBase.php:1965
ApiQueryLogEvents\getExamples
getExamples()
Returns usage examples for this module.
Definition: ApiQueryLogEvents.php:625
ApiBase\encodeParamName
encodeParamName( $paramName)
This method mangles parameter name based on the prefix supplied to the constructor.
Definition: ApiBase.php:674
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
ApiBase\GET_VALUES_FOR_HELP
const GET_VALUES_FOR_HELP
getAllowedParams() flag: When set, the result could take longer to generate, but should be more thoro...
Definition: ApiBase.php:88
ApiQueryLogEvents\$fld_parsedcomment
$fld_parsedcomment
Definition: ApiQueryLogEvents.php:40
LogEventsList\getExcludeClause
static getExcludeClause( $db, $audience='public', User $user=null)
SQL clause to skip forbidden log types for this user.
Definition: LogEventsList.php:651
ApiBase\PROP_NULLABLE
const PROP_NULLABLE
Definition: ApiBase.php:76
ApiQueryBase\addJoinConds
addJoinConds( $join_conds)
Add a set of JOIN conditions to the internal array.
Definition: ApiQueryBase.php:106
ApiQueryBase\addWhereFld
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
Definition: ApiQueryBase.php:185
ApiQueryLogEvents\__construct
__construct( $query, $moduleName)
Definition: ApiQueryLogEvents.php:34
$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
ApiQueryLogEvents\$fld_action
$fld_action
Definition: ApiQueryLogEvents.php:39
$count
$count
Definition: UtfNormalTest2.php:96
ApiQueryLogEvents\extractRowInfo
extractRowInfo( $row)
Definition: ApiQueryLogEvents.php:342
IP\sanitizeIP
static sanitizeIP( $ip)
Convert an IP into a verbose, uppercase, normalized form.
Definition: IP.php:134
DB_SLAVE
const DB_SLAVE
Definition: Defines.php:55
ApiQueryLogEvents\getParamDescription
getParamDescription()
Returns an array of parameter descriptions.
Definition: ApiQueryLogEvents.php:521
User\idFromName
static idFromName( $name)
Get database id given a user name.
Definition: User.php:502
ApiBase\LIMIT_BIG2
const LIMIT_BIG2
Definition: ApiBase.php:79
TS_UNIX
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
Definition: GlobalFunctions.php:2426
ApiQueryLogEvents\$fld_user
$fld_user
Definition: ApiQueryLogEvents.php:39
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
LogEventsList\userCan
static userCan( $row, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
Definition: LogEventsList.php:443
LogEventsList\isDeleted
static isDeleted( $row, $field)
Definition: LogEventsList.php:480
SpecialBlock\parseExpiryInput
static parseExpiryInput( $expiry)
Convert a submitted expiry time, which may be relative ("2 weeks", etc) or absolute ("24 May 2034",...
Definition: SpecialBlock.php:829
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
ApiQueryLogEvents\getCacheMode
getCacheMode( $params)
Get the cache mode for the data generated by this module.
Definition: ApiQueryLogEvents.php:448
ApiBase\PARAM_MAX2
const PARAM_MAX2
Definition: ApiBase.php:54
ApiQueryLogEvents\getResultProperties
getResultProperties()
Returns possible properties in the result, grouped by the value of the prop parameter that shows them...
Definition: ApiQueryLogEvents.php:555
ApiQueryLogEvents\execute
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
Definition: ApiQueryLogEvents.php:43
LogPage\DELETED_RESTRICTED
const DELETED_RESTRICTED
Definition: LogPage.php:36
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
ApiQueryLogEvents\$fld_tags
$fld_tags
Definition: ApiQueryLogEvents.php:41
$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
ApiQueryBase\userCanSeeRevDel
userCanSeeRevDel()
Check whether the current user has permission to view revision-deleted fields.
Definition: ApiQueryBase.php:618
$res
$res
Definition: database.txt:21
ApiQueryLogEvents\$fld_ids
$fld_ids
Definition: ApiQueryLogEvents.php:38
ApiQueryLogEvents\getAllowedLogActions
getAllowedLogActions()
Definition: ApiQueryLogEvents.php:442
ApiQueryBase\addTitleInfo
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
Definition: ApiQueryBase.php:339
$type
$type
Definition: testCompression.php:46