MediaWiki  1.27.2
ApiQueryUserContributions.php
Go to the documentation of this file.
1 <?php
33 
34  public function __construct( ApiQuery $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 = [];
73  if ( !is_array( $this->params['user'] ) ) {
74  $this->params['user'] = [ $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 = [];
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( [ 'query', $this->getModuleName() ], null, $vals );
117  if ( !$fit ) {
118  $this->setContinueEnumParameter( 'continue', $this->continueStr( $row ) );
119  break;
120  }
121  }
122 
123  $this->getResult()->addIndexedTagName(
124  [ '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 = [ '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->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
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 = [ '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( [
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 = [ '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( [ 'recentchanges' => [
290  'LEFT JOIN', [
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  [ 'tag_summary' => [ 'LEFT JOIN', [ '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  [ 'change_tag' => [ 'INNER JOIN', [ '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 = [];
334  $anyHidden = false;
335 
336  if ( $row->rev_deleted & Revision::DELETED_TEXT ) {
337  $vals['texthidden'] = true;
338  $anyHidden = true;
339  }
340 
341  // Any rows where we can't view the user were filtered out in the query.
342  $vals['userid'] = (int)$row->rev_user;
343  $vals['user'] = $row->rev_user_text;
344  if ( $row->rev_deleted & Revision::DELETED_USER ) {
345  $vals['userhidden'] = true;
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  $vals['new'] = $row->rev_parent_id == 0 && !is_null( $row->rev_parent_id );
370  $vals['minor'] = (bool)$row->rev_minor_edit;
371  $vals['top'] = $row->page_latest == $row->rev_id;
372  }
373 
374  if ( ( $this->fld_comment || $this->fld_parsedcomment ) && isset( $row->rev_comment ) ) {
375  if ( $row->rev_deleted & Revision::DELETED_COMMENT ) {
376  $vals['commenthidden'] = true;
377  $anyHidden = true;
378  }
379 
380  $userCanView = Revision::userCanBitfield(
381  $row->rev_deleted,
382  Revision::DELETED_COMMENT, $this->getUser()
383  );
384 
385  if ( $userCanView ) {
386  if ( $this->fld_comment ) {
387  $vals['comment'] = $row->rev_comment;
388  }
389 
390  if ( $this->fld_parsedcomment ) {
391  $vals['parsedcomment'] = Linker::formatComment( $row->rev_comment, $title );
392  }
393  }
394  }
395 
396  if ( $this->fld_patrolled ) {
397  $vals['patrolled'] = (bool)$row->rc_patrolled;
398  }
399 
400  if ( $this->fld_size && !is_null( $row->rev_len ) ) {
401  $vals['size'] = intval( $row->rev_len );
402  }
403 
404  if ( $this->fld_sizediff
405  && !is_null( $row->rev_len )
406  && !is_null( $row->rev_parent_id )
407  ) {
408  $parentLen = isset( $this->parentLens[$row->rev_parent_id] )
409  ? $this->parentLens[$row->rev_parent_id]
410  : 0;
411  $vals['sizediff'] = intval( $row->rev_len - $parentLen );
412  }
413 
414  if ( $this->fld_tags ) {
415  if ( $row->ts_tags ) {
416  $tags = explode( ',', $row->ts_tags );
417  ApiResult::setIndexedTagName( $tags, 'tag' );
418  $vals['tags'] = $tags;
419  } else {
420  $vals['tags'] = [];
421  }
422  }
423 
424  if ( $anyHidden && $row->rev_deleted & Revision::DELETED_RESTRICTED ) {
425  $vals['suppressed'] = true;
426  }
427 
428  return $vals;
429  }
430 
431  private function continueStr( $row ) {
432  if ( $this->multiUserMode ) {
433  return "$row->rev_user_text|$row->rev_timestamp|$row->rev_id";
434  } else {
435  return "$row->rev_timestamp|$row->rev_id";
436  }
437  }
438 
439  public function getCacheMode( $params ) {
440  // This module provides access to deleted revisions and patrol flags if
441  // the requester is logged in
442  return 'anon-public-user-private';
443  }
444 
445  public function getAllowedParams() {
446  return [
447  'limit' => [
448  ApiBase::PARAM_DFLT => 10,
449  ApiBase::PARAM_TYPE => 'limit',
450  ApiBase::PARAM_MIN => 1,
453  ],
454  'start' => [
455  ApiBase::PARAM_TYPE => 'timestamp'
456  ],
457  'end' => [
458  ApiBase::PARAM_TYPE => 'timestamp'
459  ],
460  'continue' => [
461  ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
462  ],
463  'user' => [
464  ApiBase::PARAM_TYPE => 'user',
466  ],
467  'userprefix' => null,
468  'dir' => [
469  ApiBase::PARAM_DFLT => 'older',
471  'newer',
472  'older'
473  ],
474  ApiBase::PARAM_HELP_MSG => 'api-help-param-direction',
475  ],
476  'namespace' => [
477  ApiBase::PARAM_ISMULTI => true,
478  ApiBase::PARAM_TYPE => 'namespace'
479  ],
480  'prop' => [
481  ApiBase::PARAM_ISMULTI => true,
482  ApiBase::PARAM_DFLT => 'ids|title|timestamp|comment|size|flags',
484  'ids',
485  'title',
486  'timestamp',
487  'comment',
488  'parsedcomment',
489  'size',
490  'sizediff',
491  'flags',
492  'patrolled',
493  'tags'
494  ],
496  ],
497  'show' => [
498  ApiBase::PARAM_ISMULTI => true,
500  'minor',
501  '!minor',
502  'patrolled',
503  '!patrolled',
504  'top',
505  '!top',
506  'new',
507  '!new',
508  ],
510  'apihelp-query+usercontribs-param-show',
511  $this->getConfig()->get( 'RCMaxAge' )
512  ],
513  ],
514  'tag' => null,
515  'toponly' => [
516  ApiBase::PARAM_DFLT => false,
518  ],
519  ];
520  }
521 
522  protected function getExamplesMessages() {
523  return [
524  'action=query&list=usercontribs&ucuser=Example'
525  => 'apihelp-query+usercontribs-example-user',
526  'action=query&list=usercontribs&ucuserprefix=192.0.2.'
527  => 'apihelp-query+usercontribs-example-ipprefix',
528  ];
529  }
530 
531  public function getHelpUrls() {
532  return 'https://www.mediawiki.org/wiki/API:Usercontribs';
533  }
534 }
select($method, $extraQuery=[])
Execute a SELECT query based on the values in the internal arrays.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below...
Definition: ApiBase.php:88
getDB()
Get the Query database connection (read-only)
const LIMIT_BIG2
Fast query, apihighlimits limit.
Definition: ApiBase.php:186
prepareUsername($user)
Validate the 'user' parameter and set the value to compare against revision.
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1418
getResult()
Get the result object.
Definition: ApiBase.php:584
addWhereFld($field, $value)
Equivalent to addWhere(array($field => $value))
static getCanonicalName($name, $validate= 'valid')
Given unvalidated user input, return a canonical username, or false if the username is invalid...
Definition: User.php:1050
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
Definition: ApiBase.php:50
const LIMIT_BIG1
Fast query, standard limit.
Definition: ApiBase.php:184
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...
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition: ApiBase.php:91
This is a base class for all Query modules.
extractRequestParams($parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user...
Definition: ApiBase.php:685
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
Definition: ApiBase.php:157
addTimestampWhereRange($field, $dir, $start, $end, $sort=true)
Add a WHERE clause corresponding to a range, similar to addWhereRange, but converts $start and $end t...
addWhere($value)
Add a set of WHERE clauses to the internal array.
addJoinConds($join_conds)
Add a set of JOIN conditions to the internal array.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:618
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
Definition: hooks.txt:1798
prepareQuery()
Prepares the query and returns the limit of rows requested.
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
addWhereIf($value, $condition)
Same as addWhere(), but add the WHERE clauses only if a condition is met.
$res
Definition: database.txt:21
getConfig()
Get the Config object.
addOption($name, $value=null)
Add an option such as LIMIT or USE INDEX.
static isIP($name)
Does the string match an anonymous IPv4 address?
Definition: User.php:830
const DELETED_RESTRICTED
Definition: Revision.php:79
const DB_SLAVE
Definition: Defines.php:46
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:912
getModuleName()
Get the name of the module being executed by this instance.
Definition: ApiBase.php:464
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right, for PARAM_TYPE 'limit'.
Definition: ApiBase.php:97
This is the main query class.
Definition: ApiQuery.php:38
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
dieContinueUsageIf($condition)
Die with the $prefix.
Definition: ApiBase.php:2181
static formatComment($comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
Definition: Linker.php:1290
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter...
Definition: ApiBase.php:125
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 local account $user
Definition: hooks.txt:242
const DELETED_TEXT
Definition: Revision.php:76
addFieldsIf($value, $condition)
Same as addFields(), but add the fields only if a condition is met.
if($IP===false)
Definition: WebStart.php:59
__construct(ApiQuery $query, $moduleName)
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
const DELETED_USER
Definition: Revision.php:78
addFields($value)
Add a set of fields to select to the internal array.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Definition: ApiBase.php:53
extractRowInfo($row)
Extract fields from the database row and append them to a result array.
setContinueEnumParameter($paramName, $paramValue)
Set a query-continue value.
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:1526
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive $limit
Definition: hooks.txt:1004
$count
static getParentLengths($db, array $revIds)
Do a batched query to get the parent revision lengths.
Definition: Revision.php:527
This query action adds a list of a specified user's contributions to the output.
const PARAM_DEPRECATED
(boolean) Is the parameter deprecated (will show a warning)?
Definition: ApiBase.php:106
static userCanBitfield($bitfield, $field, User $user=null, Title $title=null)
Determine if the current user is allowed to view a particular field of this revision, if it's marked as deleted.
Definition: Revision.php:1710
const DELETED_COMMENT
Definition: Revision.php:77
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition: ApiBase.php:100
static addTitleInfo(&$arr, $title, $prefix= '')
Add information (title and namespace) about a Title object to a result array.
getUser()
Get the User object.
addTables($tables, $alias=null)
Add a set of tables to the internal array.
dieUsageMsg($error)
Output the error message related to a certain array.
Definition: ApiBase.php:2144
static & makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:524
selectNamedDB($name, $db, $groups)
Selects the query database connection with the given name.
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:310