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