MediaWiki  1.23.8
ApiQueryUserContributions.php
Go to the documentation of this file.
1 <?php
33 
34  public function __construct( $query, $moduleName ) {
35  parent::__construct( $query, $moduleName, 'uc' );
36  }
37 
39  private $fld_ids = false, $fld_title = false, $fld_timestamp = false,
40  $fld_comment = false, $fld_parsedcomment = false, $fld_flags = false,
41  $fld_patrolled = false, $fld_tags = false, $fld_size = false, $fld_sizediff = false;
42 
43  public function execute() {
44  // Parse some parameters
45  $this->params = $this->extractRequestParams();
46 
47  $prop = array_flip( $this->params['prop'] );
48  $this->fld_ids = isset( $prop['ids'] );
49  $this->fld_title = isset( $prop['title'] );
50  $this->fld_comment = isset( $prop['comment'] );
51  $this->fld_parsedcomment = isset( $prop['parsedcomment'] );
52  $this->fld_size = isset( $prop['size'] );
53  $this->fld_sizediff = isset( $prop['sizediff'] );
54  $this->fld_flags = isset( $prop['flags'] );
55  $this->fld_timestamp = isset( $prop['timestamp'] );
56  $this->fld_patrolled = isset( $prop['patrolled'] );
57  $this->fld_tags = isset( $prop['tags'] );
58 
59  // Most of this code will use the 'contributions' group DB, which can map to slaves
60  // with extra user based indexes or partioning by user. The additional metadata
61  // queries should use a regular slave since the lookup pattern is not all by user.
62  $dbSecondary = $this->getDB(); // any random slave
63 
64  // TODO: if the query is going only against the revision table, should this be done?
65  $this->selectNamedDB( 'contributions', DB_SLAVE, 'contributions' );
66 
67  if ( isset( $this->params['userprefix'] ) ) {
68  $this->prefixMode = true;
69  $this->multiUserMode = true;
70  $this->userprefix = $this->params['userprefix'];
71  } else {
72  $this->usernames = array();
73  if ( !is_array( $this->params['user'] ) ) {
74  $this->params['user'] = array( $this->params['user'] );
75  }
76  if ( !count( $this->params['user'] ) ) {
77  $this->dieUsage( 'User parameter may not be empty.', 'param_user' );
78  }
79  foreach ( $this->params['user'] as $u ) {
80  $this->prepareUsername( $u );
81  }
82  $this->prefixMode = false;
83  $this->multiUserMode = ( count( $this->params['user'] ) > 1 );
84  }
85 
86  $this->prepareQuery();
87 
88  // Do the actual query.
89  $res = $this->select( __METHOD__ );
90 
91  if ( $this->fld_sizediff ) {
92  $revIds = array();
93  foreach ( $res as $row ) {
94  if ( $row->rev_parent_id ) {
95  $revIds[] = $row->rev_parent_id;
96  }
97  }
98  $this->parentLens = Revision::getParentLengths( $dbSecondary, $revIds );
99  $res->rewind(); // reset
100  }
101 
102  // Initialise some variables
103  $count = 0;
104  $limit = $this->params['limit'];
105 
106  // Fetch each row
107  foreach ( $res as $row ) {
108  if ( ++$count > $limit ) {
109  // We've reached the one extra which shows that there are
110  // additional pages to be had. Stop here...
111  $this->setContinueEnumParameter( 'continue', $this->continueStr( $row ) );
112  break;
113  }
114 
115  $vals = $this->extractRowInfo( $row );
116  $fit = $this->getResult()->addValue( array( 'query', $this->getModuleName() ), null, $vals );
117  if ( !$fit ) {
118  $this->setContinueEnumParameter( 'continue', $this->continueStr( $row ) );
119  break;
120  }
121  }
122 
123  $this->getResult()->setIndexedTagName_internal(
124  array( 'query', $this->getModuleName() ),
125  'item'
126  );
127  }
128 
135  private function prepareUsername( $user ) {
136  if ( !is_null( $user ) && $user !== '' ) {
137  $name = User::isIP( $user )
138  ? $user
139  : User::getCanonicalName( $user, 'valid' );
140  if ( $name === false ) {
141  $this->dieUsage( "User name {$user} is not valid", 'param_user' );
142  } else {
143  $this->usernames[] = $name;
144  }
145  } else {
146  $this->dieUsage( 'User parameter may not be empty', 'param_user' );
147  }
148  }
149 
153  private function prepareQuery() {
154  // We're after the revision table, and the corresponding page
155  // row for anything we retrieve. We may also need the
156  // recentchanges row and/or tag summary row.
157  $user = $this->getUser();
158  $tables = array( 'page', 'revision' ); // Order may change
159  $this->addWhere( 'page_id=rev_page' );
160 
161  // Handle continue parameter
162  if ( !is_null( $this->params['continue'] ) ) {
163  $continue = explode( '|', $this->params['continue'] );
164  $db = $this->getDB();
165  if ( $this->multiUserMode ) {
166  $this->dieContinueUsageIf( count( $continue ) != 3 );
167  $encUser = $db->addQuotes( array_shift( $continue ) );
168  } else {
169  $this->dieContinueUsageIf( count( $continue ) != 2 );
170  }
171  $encTS = $db->addQuotes( $db->timestamp( $continue[0] ) );
172  $encId = (int)$continue[1];
173  $this->dieContinueUsageIf( $encId != $continue[1] );
174  $op = ( $this->params['dir'] == 'older' ? '<' : '>' );
175  if ( $this->multiUserMode ) {
176  $this->addWhere(
177  "rev_user_text $op $encUser OR " .
178  "(rev_user_text = $encUser AND " .
179  "(rev_timestamp $op $encTS OR " .
180  "(rev_timestamp = $encTS AND " .
181  "rev_id $op= $encId)))"
182  );
183  } else {
184  $this->addWhere(
185  "rev_timestamp $op $encTS OR " .
186  "(rev_timestamp = $encTS AND " .
187  "rev_id $op= $encId)"
188  );
189  }
190  }
191 
192  // Don't include any revisions where we're not supposed to be able to
193  // see the username.
194  if ( !$user->isAllowed( 'deletedhistory' ) ) {
195  $bitmask = Revision::DELETED_USER;
196  } elseif ( !$user->isAllowed( 'suppressrevision' ) ) {
198  } else {
199  $bitmask = 0;
200  }
201  if ( $bitmask ) {
202  $this->addWhere( $this->getDB()->bitAnd( 'rev_deleted', $bitmask ) . " != $bitmask" );
203  }
204 
205  // We only want pages by the specified users.
206  if ( $this->prefixMode ) {
207  $this->addWhere( 'rev_user_text' .
208  $this->getDB()->buildLike( $this->userprefix, $this->getDB()->anyString() ) );
209  } else {
210  $this->addWhereFld( 'rev_user_text', $this->usernames );
211  }
212  // ... and in the specified timeframe.
213  // Ensure the same sort order for rev_user_text and rev_timestamp
214  // so our query is indexed
215  if ( $this->multiUserMode ) {
216  $this->addWhereRange( 'rev_user_text', $this->params['dir'], null, null );
217  }
218  $this->addTimestampWhereRange( 'rev_timestamp',
219  $this->params['dir'], $this->params['start'], $this->params['end'] );
220  // Include in ORDER BY for uniqueness
221  $this->addWhereRange( 'rev_id', $this->params['dir'], null, null );
222 
223  $this->addWhereFld( 'page_namespace', $this->params['namespace'] );
224 
225  $show = $this->params['show'];
226  if ( $this->params['toponly'] ) { // deprecated/old param
227  $show[] = 'top';
228  }
229  if ( !is_null( $show ) ) {
230  $show = array_flip( $show );
231 
232  if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) )
233  || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
234  || ( isset( $show['top'] ) && isset( $show['!top'] ) )
235  || ( isset( $show['new'] ) && isset( $show['!new'] ) )
236  ) {
237  $this->dieUsageMsg( 'show' );
238  }
239 
240  $this->addWhereIf( 'rev_minor_edit = 0', isset( $show['!minor'] ) );
241  $this->addWhereIf( 'rev_minor_edit != 0', isset( $show['minor'] ) );
242  $this->addWhereIf( 'rc_patrolled = 0', isset( $show['!patrolled'] ) );
243  $this->addWhereIf( 'rc_patrolled != 0', isset( $show['patrolled'] ) );
244  $this->addWhereIf( 'rev_id != page_latest', isset( $show['!top'] ) );
245  $this->addWhereIf( 'rev_id = page_latest', isset( $show['top'] ) );
246  $this->addWhereIf( 'rev_parent_id != 0', isset( $show['!new'] ) );
247  $this->addWhereIf( 'rev_parent_id = 0', isset( $show['new'] ) );
248  }
249  $this->addOption( 'LIMIT', $this->params['limit'] + 1 );
250  $index = array( 'revision' => 'usertext_timestamp' );
251 
252  // Mandatory fields: timestamp allows request continuation
253  // ns+title checks if the user has access rights for this page
254  // user_text is necessary if multiple users were specified
255  $this->addFields( array(
256  'rev_id',
257  'rev_timestamp',
258  'page_namespace',
259  'page_title',
260  'rev_user',
261  'rev_user_text',
262  'rev_deleted'
263  ) );
264 
265  if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ||
266  $this->fld_patrolled
267  ) {
268  if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
269  $this->dieUsage(
270  'You need the patrol right to request the patrolled flag',
271  'permissiondenied'
272  );
273  }
274 
275  // Use a redundant join condition on both
276  // timestamp and ID so we can use the timestamp
277  // index
278  $index['recentchanges'] = 'rc_user_text';
279  if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ) {
280  // Put the tables in the right order for
281  // STRAIGHT_JOIN
282  $tables = array( 'revision', 'recentchanges', 'page' );
283  $this->addOption( 'STRAIGHT_JOIN' );
284  $this->addWhere( 'rc_user_text=rev_user_text' );
285  $this->addWhere( 'rc_timestamp=rev_timestamp' );
286  $this->addWhere( 'rc_this_oldid=rev_id' );
287  } else {
288  $tables[] = 'recentchanges';
289  $this->addJoinConds( array( 'recentchanges' => array(
290  'LEFT JOIN', array(
291  'rc_user_text=rev_user_text',
292  'rc_timestamp=rev_timestamp',
293  'rc_this_oldid=rev_id' ) ) ) );
294  }
295  }
296 
297  $this->addTables( $tables );
298  $this->addFieldsIf( 'rev_page', $this->fld_ids );
299  $this->addFieldsIf( 'page_latest', $this->fld_flags );
300  // $this->addFieldsIf( 'rev_text_id', $this->fld_ids ); // Should this field be exposed?
301  $this->addFieldsIf( 'rev_comment', $this->fld_comment || $this->fld_parsedcomment );
302  $this->addFieldsIf( 'rev_len', $this->fld_size || $this->fld_sizediff );
303  $this->addFieldsIf( 'rev_minor_edit', $this->fld_flags );
304  $this->addFieldsIf( 'rev_parent_id', $this->fld_flags || $this->fld_sizediff || $this->fld_ids );
305  $this->addFieldsIf( 'rc_patrolled', $this->fld_patrolled );
306 
307  if ( $this->fld_tags ) {
308  $this->addTables( 'tag_summary' );
309  $this->addJoinConds(
310  array( 'tag_summary' => array( 'LEFT JOIN', array( 'rev_id=ts_rev_id' ) ) )
311  );
312  $this->addFields( 'ts_tags' );
313  }
314 
315  if ( isset( $this->params['tag'] ) ) {
316  $this->addTables( 'change_tag' );
317  $this->addJoinConds(
318  array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) )
319  );
320  $this->addWhereFld( 'ct_tag', $this->params['tag'] );
321  }
322 
323  $this->addOption( 'USE INDEX', $index );
324  }
325 
332  private function extractRowInfo( $row ) {
333  $vals = array();
334  $anyHidden = false;
335 
336  if ( $row->rev_deleted & Revision::DELETED_TEXT ) {
337  $vals['texthidden'] = '';
338  $anyHidden = true;
339  }
340 
341  // Any rows where we can't view the user were filtered out in the query.
342  $vals['userid'] = $row->rev_user;
343  $vals['user'] = $row->rev_user_text;
344  if ( $row->rev_deleted & Revision::DELETED_USER ) {
345  $vals['userhidden'] = '';
346  $anyHidden = true;
347  }
348  if ( $this->fld_ids ) {
349  $vals['pageid'] = intval( $row->rev_page );
350  $vals['revid'] = intval( $row->rev_id );
351  // $vals['textid'] = intval( $row->rev_text_id ); // todo: Should this field be exposed?
352 
353  if ( !is_null( $row->rev_parent_id ) ) {
354  $vals['parentid'] = intval( $row->rev_parent_id );
355  }
356  }
357 
358  $title = Title::makeTitle( $row->page_namespace, $row->page_title );
359 
360  if ( $this->fld_title ) {
362  }
363 
364  if ( $this->fld_timestamp ) {
365  $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->rev_timestamp );
366  }
367 
368  if ( $this->fld_flags ) {
369  if ( $row->rev_parent_id == 0 && !is_null( $row->rev_parent_id ) ) {
370  $vals['new'] = '';
371  }
372  if ( $row->rev_minor_edit ) {
373  $vals['minor'] = '';
374  }
375  if ( $row->page_latest == $row->rev_id ) {
376  $vals['top'] = '';
377  }
378  }
379 
380  if ( ( $this->fld_comment || $this->fld_parsedcomment ) && isset( $row->rev_comment ) ) {
381  if ( $row->rev_deleted & Revision::DELETED_COMMENT ) {
382  $vals['commenthidden'] = '';
383  $anyHidden = true;
384  }
385 
386  $userCanView = Revision::userCanBitfield(
387  $row->rev_deleted,
388  Revision::DELETED_COMMENT, $this->getUser()
389  );
390 
391  if ( $userCanView ) {
392  if ( $this->fld_comment ) {
393  $vals['comment'] = $row->rev_comment;
394  }
395 
396  if ( $this->fld_parsedcomment ) {
397  $vals['parsedcomment'] = Linker::formatComment( $row->rev_comment, $title );
398  }
399  }
400  }
401 
402  if ( $this->fld_patrolled && $row->rc_patrolled ) {
403  $vals['patrolled'] = '';
404  }
405 
406  if ( $this->fld_size && !is_null( $row->rev_len ) ) {
407  $vals['size'] = intval( $row->rev_len );
408  }
409 
410  if ( $this->fld_sizediff
411  && !is_null( $row->rev_len )
412  && !is_null( $row->rev_parent_id )
413  ) {
414  $parentLen = isset( $this->parentLens[$row->rev_parent_id] )
415  ? $this->parentLens[$row->rev_parent_id]
416  : 0;
417  $vals['sizediff'] = intval( $row->rev_len - $parentLen );
418  }
419 
420  if ( $this->fld_tags ) {
421  if ( $row->ts_tags ) {
422  $tags = explode( ',', $row->ts_tags );
423  $this->getResult()->setIndexedTagName( $tags, 'tag' );
424  $vals['tags'] = $tags;
425  } else {
426  $vals['tags'] = array();
427  }
428  }
429 
430  if ( $anyHidden && $row->rev_deleted & Revision::DELETED_RESTRICTED ) {
431  $vals['suppressed'] = '';
432  }
433 
434  return $vals;
435  }
436 
437  private function continueStr( $row ) {
438  if ( $this->multiUserMode ) {
439  return "$row->rev_user_text|$row->rev_timestamp|$row->rev_id";
440  } else {
441  return "$row->rev_timestamp|$row->rev_id";
442  }
443  }
444 
445  public function getCacheMode( $params ) {
446  // This module provides access to deleted revisions and patrol flags if
447  // the requester is logged in
448  return 'anon-public-user-private';
449  }
450 
451  public function getAllowedParams() {
452  return array(
453  'limit' => array(
454  ApiBase::PARAM_DFLT => 10,
455  ApiBase::PARAM_TYPE => 'limit',
456  ApiBase::PARAM_MIN => 1,
459  ),
460  'start' => array(
461  ApiBase::PARAM_TYPE => 'timestamp'
462  ),
463  'end' => array(
464  ApiBase::PARAM_TYPE => 'timestamp'
465  ),
466  'continue' => null,
467  'user' => array(
468  ApiBase::PARAM_ISMULTI => true
469  ),
470  'userprefix' => null,
471  'dir' => array(
472  ApiBase::PARAM_DFLT => 'older',
474  'newer',
475  'older'
476  )
477  ),
478  'namespace' => array(
479  ApiBase::PARAM_ISMULTI => true,
480  ApiBase::PARAM_TYPE => 'namespace'
481  ),
482  'prop' => array(
483  ApiBase::PARAM_ISMULTI => true,
484  ApiBase::PARAM_DFLT => 'ids|title|timestamp|comment|size|flags',
486  'ids',
487  'title',
488  'timestamp',
489  'comment',
490  'parsedcomment',
491  'size',
492  'sizediff',
493  'flags',
494  'patrolled',
495  'tags'
496  )
497  ),
498  'show' => array(
499  ApiBase::PARAM_ISMULTI => true,
501  'minor',
502  '!minor',
503  'patrolled',
504  '!patrolled',
505  'top',
506  '!top',
507  'new',
508  '!new',
509  )
510  ),
511  'tag' => null,
512  'toponly' => array(
513  ApiBase::PARAM_DFLT => false,
515  ),
516  );
517  }
518 
519  public function getParamDescription() {
520  global $wgRCMaxAge;
521  $p = $this->getModulePrefix();
522 
523  return array(
524  'limit' => 'The maximum number of contributions to return',
525  'start' => 'The start timestamp to return from',
526  'end' => 'The end timestamp to return to',
527  'continue' => 'When more results are available, use this to continue',
528  'user' => 'The users to retrieve contributions for',
529  'userprefix' => array(
530  "Retrieve contributions for all users whose names begin with this value.",
531  "Overrides {$p}user",
532  ),
533  'dir' => $this->getDirectionDescription( $p ),
534  'namespace' => 'Only list contributions in these namespaces',
535  'prop' => array(
536  'Include additional pieces of information',
537  ' ids - Adds the page ID and revision ID',
538  ' title - Adds the title and namespace ID of the page',
539  ' timestamp - Adds the timestamp of the edit',
540  ' comment - Adds the comment of the edit',
541  ' parsedcomment - Adds the parsed comment of the edit',
542  ' size - Adds the new size of the edit',
543  ' sizediff - Adds the size delta of the edit against its parent',
544  ' flags - Adds flags of the edit',
545  ' patrolled - Tags patrolled edits',
546  ' tags - Lists tags for the edit',
547  ),
548  'show' => array(
549  "Show only items that meet thse criteria, e.g. non minor edits only: {$p}show=!minor",
550  "NOTE: If {$p}show=patrolled or {$p}show=!patrolled is set, revisions older than",
551  "\$wgRCMaxAge ($wgRCMaxAge) won't be shown",
552  ),
553  'tag' => 'Only list revisions tagged with this tag',
554  'toponly' => 'Only list changes which are the latest revision',
555  );
556  }
557 
558  public function getResultProperties() {
559  return array(
560  '' => array(
561  'userid' => 'integer',
562  'user' => 'string',
563  'userhidden' => 'boolean'
564  ),
565  'ids' => array(
566  'pageid' => 'integer',
567  'revid' => 'integer',
568  'parentid' => array(
569  ApiBase::PROP_TYPE => 'integer',
570  ApiBase::PROP_NULLABLE => true
571  )
572  ),
573  'title' => array(
574  'ns' => 'namespace',
575  'title' => 'string'
576  ),
577  'timestamp' => array(
578  'timestamp' => 'timestamp'
579  ),
580  'flags' => array(
581  'new' => 'boolean',
582  'minor' => 'boolean',
583  'top' => 'boolean'
584  ),
585  'comment' => array(
586  'commenthidden' => 'boolean',
587  'comment' => array(
588  ApiBase::PROP_TYPE => 'string',
589  ApiBase::PROP_NULLABLE => true
590  )
591  ),
592  'parsedcomment' => array(
593  'commenthidden' => 'boolean',
594  'parsedcomment' => array(
595  ApiBase::PROP_TYPE => 'string',
596  ApiBase::PROP_NULLABLE => true
597  )
598  ),
599  'patrolled' => array(
600  'patrolled' => 'boolean'
601  ),
602  'size' => array(
603  'size' => array(
604  ApiBase::PROP_TYPE => 'integer',
605  ApiBase::PROP_NULLABLE => true
606  )
607  ),
608  'sizediff' => array(
609  'sizediff' => array(
610  ApiBase::PROP_TYPE => 'integer',
611  ApiBase::PROP_NULLABLE => true
612  )
613  )
614  );
615  }
616 
617  public function getDescription() {
618  return 'Get all edits by a user.';
619  }
620 
621  public function getPossibleErrors() {
622  return array_merge( parent::getPossibleErrors(), array(
623  array( 'code' => 'param_user', 'info' => 'User parameter may not be empty.' ),
624  array( 'code' => 'param_user', 'info' => 'User name user is not valid' ),
625  array( 'show' ),
626  array(
627  'code' => 'permissiondenied',
628  'info' => 'You need the patrol right to request the patrolled flag'
629  ),
630  ) );
631  }
632 
633  public function getExamples() {
634  return array(
635  'api.php?action=query&list=usercontribs&ucuser=YurikBot',
636  'api.php?action=query&list=usercontribs&ucuserprefix=217.121.114.',
637  );
638  }
639 
640  public function getHelpUrls() {
641  return 'https://www.mediawiki.org/wiki/API:Usercontribs';
642  }
643 }
ApiQueryContributions\getPossibleErrors
getPossibleErrors()
Definition: ApiQueryUserContributions.php:621
Revision\DELETED_USER
const DELETED_USER
Definition: Revision.php:67
Title\makeTitle
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:398
Revision\DELETED_RESTRICTED
const DELETED_RESTRICTED
Definition: Revision.php:68
ApiQueryBase\addFields
addFields( $value)
Add a set of fields to select to the internal array.
Definition: ApiQueryBase.php:117
Revision\DELETED_COMMENT
const DELETED_COMMENT
Definition: Revision.php:66
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
ApiQueryContributions\$fld_patrolled
$fld_patrolled
Definition: ApiQueryUserContributions.php:41
ApiQueryContributions\getAllowedParams
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Definition: ApiQueryUserContributions.php:451
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
ApiBase\dieUsageMsg
dieUsageMsg( $error)
Output the error message related to a certain array.
Definition: ApiBase.php:1933
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
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
ApiQueryContributions\$parentLens
$parentLens
Definition: ApiQueryUserContributions.php:38
ApiQueryBase\getDirectionDescription
getDirectionDescription( $p='', $extraDirText='')
Gets the personalised direction parameter description.
Definition: ApiQueryBase.php:524
$limit
if( $sleep) $limit
Definition: importImages.php:99
ApiQueryContributions\$params
$params
Definition: ApiQueryUserContributions.php:38
Revision\userCanBitfield
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision,...
Definition: Revision.php:1641
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
ApiQueryContributions\getParamDescription
getParamDescription()
Returns an array of parameter descriptions.
Definition: ApiQueryUserContributions.php:519
ApiQueryContributions\getDescription
getDescription()
Returns the description string for this module.
Definition: ApiQueryUserContributions.php:617
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:132
ApiQueryContributions\$fld_title
$fld_title
Definition: ApiQueryUserContributions.php:39
ApiQueryBase\addFieldsIf
addFieldsIf( $value, $condition)
Same as addFields(), but add the fields only if a condition is met.
Definition: ApiQueryBase.php:131
ApiQueryContributions\$multiUserMode
$multiUserMode
Definition: ApiQueryUserContributions.php:38
ApiQueryContributions\execute
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
Definition: ApiQueryUserContributions.php:43
ApiBase\PARAM_DEPRECATED
const PARAM_DEPRECATED
Definition: ApiBase.php:60
ApiBase\PARAM_MIN
const PARAM_MIN
Definition: ApiBase.php:56
ApiQueryContributions\$fld_sizediff
$fld_sizediff
Definition: ApiQueryUserContributions.php:41
ApiQueryContributions\$prefixMode
$prefixMode
Definition: ApiQueryUserContributions.php:38
ApiQueryContributions\$fld_size
$fld_size
Definition: ApiQueryUserContributions.php:41
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
ApiQueryContributions\$fld_ids
$fld_ids
Definition: ApiQueryUserContributions.php:39
ApiQueryBase\getDB
getDB()
Get the Query database connection (read-only)
Definition: ApiQueryBase.php:417
ApiQueryContributions\$fld_timestamp
$fld_timestamp
Definition: ApiQueryUserContributions.php:39
ApiBase\PARAM_MAX
const PARAM_MAX
Definition: ApiBase.php:52
User\isIP
static isIP( $name)
Does the string match an anonymous IPv4 address?
Definition: User.php:555
ApiQueryBase\addTables
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
Definition: ApiQueryBase.php:82
ApiQueryContributions\$fld_tags
$fld_tags
Definition: ApiQueryUserContributions.php:41
ApiQueryContributions\getCacheMode
getCacheMode( $params)
Get the cache mode for the data generated by this module.
Definition: ApiQueryUserContributions.php:445
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
ApiQueryContributions\getHelpUrls
getHelpUrls()
Definition: ApiQueryUserContributions.php:640
ApiQueryContributions\continueStr
continueStr( $row)
Definition: ApiQueryUserContributions.php:437
ApiBase\PROP_TYPE
const PROP_TYPE
Definition: ApiBase.php:74
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
ApiQueryContributions\prepareQuery
prepareQuery()
Prepares the query and returns the limit of rows requested.
Definition: ApiQueryUserContributions.php:153
ApiQueryContributions\$userprefix
$userprefix
Definition: ApiQueryUserContributions.php:38
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
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
ApiQueryContributions\getResultProperties
getResultProperties()
Returns possible properties in the result, grouped by the value of the prop parameter that shows them...
Definition: ApiQueryUserContributions.php:558
ApiQueryContributions\$fld_flags
$fld_flags
Definition: ApiQueryUserContributions.php:40
ApiBase\dieContinueUsageIf
dieContinueUsageIf( $condition)
Die with the $prefix.
Definition: ApiBase.php:1969
Revision\getParentLengths
static getParentLengths( $db, array $revIds)
Do a batched query to get the parent revision lengths.
Definition: Revision.php:503
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
ApiQueryContributions\extractRowInfo
extractRowInfo( $row)
Extract fields from the database row and append them to a result array.
Definition: ApiQueryUserContributions.php:332
ApiQueryContributions\prepareUsername
prepareUsername( $user)
Validate the 'user' parameter and set the value to compare against revision.
Definition: ApiQueryUserContributions.php:135
ApiBase\PROP_NULLABLE
const PROP_NULLABLE
Definition: ApiBase.php:76
ApiQueryContributions\$fld_comment
$fld_comment
Definition: ApiQueryUserContributions.php:40
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
ApiQueryContributions\__construct
__construct( $query, $moduleName)
Definition: ApiQueryUserContributions.php:34
ApiQueryContributions\$fld_parsedcomment
$fld_parsedcomment
Definition: ApiQueryUserContributions.php:40
$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
DB_SLAVE
const DB_SLAVE
Definition: Defines.php:55
ApiQueryBase\selectNamedDB
selectNamedDB( $name, $db, $groups)
Selects the query database connection with the given name.
Definition: ApiQueryBase.php:433
ApiBase\LIMIT_BIG2
const LIMIT_BIG2
Definition: ApiBase.php:79
ApiQueryBase\$tables
$tables
Definition: ApiQueryBase.php:36
User\getCanonicalName
static getCanonicalName( $name, $validate='valid')
Given unvalidated user input, return a canonical username, or false if the username is invalid.
Definition: User.php:884
ApiBase\PARAM_DFLT
const PARAM_DFLT
Definition: ApiBase.php:46
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
ApiBase\getModuleName
getModuleName()
Get the name of the module being executed by this instance.
Definition: ApiBase.php:148
ApiBase\PARAM_ISMULTI
const PARAM_ISMULTI
Definition: ApiBase.php:48
ApiQueryContributions\$usernames
$usernames
Definition: ApiQueryUserContributions.php:38
ApiBase\PARAM_MAX2
const PARAM_MAX2
Definition: ApiBase.php:54
ApiQueryBase\addWhere
addWhere( $value)
Add a set of WHERE clauses to the internal array.
Definition: ApiQueryBase.php:152
ApiQueryBase\setContinueEnumParameter
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
Definition: ApiQueryBase.php:404
ApiQueryContributions\getExamples
getExamples()
Returns usage examples for this module.
Definition: ApiQueryUserContributions.php:633
$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
$res
$res
Definition: database.txt:21
Revision\DELETED_TEXT
const DELETED_TEXT
Definition: Revision.php:65
ApiQueryBase\addWhereIf
addWhereIf( $value, $condition)
Same as addWhere(), but add the WHERE clauses only if a condition is met.
Definition: ApiQueryBase.php:170
ApiQueryBase\addTitleInfo
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
Definition: ApiQueryBase.php:339
ApiQueryContributions
This query action adds a list of a specified user's contributions to the output.
Definition: ApiQueryUserContributions.php:32