MediaWiki  1.23.13
ApiQueryDeletedrevs.php
Go to the documentation of this file.
1 <?php
33 
34  public function __construct( $query, $moduleName ) {
35  parent::__construct( $query, $moduleName, 'dr' );
36  }
37 
38  public function execute() {
39  $user = $this->getUser();
40  // Before doing anything at all, let's check permissions
41  if ( !$user->isAllowed( 'deletedhistory' ) ) {
42  $this->dieUsage(
43  'You don\'t have permission to view deleted revision information',
44  'permissiondenied'
45  );
46  }
47 
48  $db = $this->getDB();
49  $params = $this->extractRequestParams( false );
50  $prop = array_flip( $params['prop'] );
51  $fld_parentid = isset( $prop['parentid'] );
52  $fld_revid = isset( $prop['revid'] );
53  $fld_user = isset( $prop['user'] );
54  $fld_userid = isset( $prop['userid'] );
55  $fld_comment = isset( $prop['comment'] );
56  $fld_parsedcomment = isset( $prop['parsedcomment'] );
57  $fld_minor = isset( $prop['minor'] );
58  $fld_len = isset( $prop['len'] );
59  $fld_sha1 = isset( $prop['sha1'] );
60  $fld_content = isset( $prop['content'] );
61  $fld_token = isset( $prop['token'] );
62  $fld_tags = isset( $prop['tags'] );
63 
64  // If we're in JSON callback mode, no tokens can be obtained
65  if ( !is_null( $this->getMain()->getRequest()->getVal( 'callback' ) ) ) {
66  $fld_token = false;
67  }
68 
69  // If user can't undelete, no tokens
70  if ( !$user->isAllowed( 'undelete' ) ) {
71  $fld_token = false;
72  }
73 
74  $result = $this->getResult();
75  $pageSet = $this->getPageSet();
76  $titles = $pageSet->getTitles();
77 
78  // This module operates in three modes:
79  // 'revs': List deleted revs for certain titles (1)
80  // 'user': List deleted revs by a certain user (2)
81  // 'all': List all deleted revs in NS (3)
82  $mode = 'all';
83  if ( count( $titles ) > 0 ) {
84  $mode = 'revs';
85  } elseif ( !is_null( $params['user'] ) ) {
86  $mode = 'user';
87  }
88 
89  if ( $mode == 'revs' || $mode == 'user' ) {
90  // Ignore namespace and unique due to inability to know whether they were purposely set
91  foreach ( array( 'from', 'to', 'prefix', /*'namespace', 'unique'*/ ) as $p ) {
92  if ( !is_null( $params[$p] ) ) {
93  $this->dieUsage( "The '{$p}' parameter cannot be used in modes 1 or 2", 'badparams' );
94  }
95  }
96  } else {
97  foreach ( array( 'start', 'end' ) as $p ) {
98  if ( !is_null( $params[$p] ) ) {
99  $this->dieUsage( "The {$p} parameter cannot be used in mode 3", 'badparams' );
100  }
101  }
102  }
103 
104  if ( !is_null( $params['user'] ) && !is_null( $params['excludeuser'] ) ) {
105  $this->dieUsage( 'user and excludeuser cannot be used together', 'badparams' );
106  }
107 
108  $this->addTables( 'archive' );
109  $this->addFields( array( 'ar_title', 'ar_namespace', 'ar_timestamp', 'ar_deleted', 'ar_id' ) );
110 
111  $this->addFieldsIf( 'ar_parent_id', $fld_parentid );
112  $this->addFieldsIf( 'ar_rev_id', $fld_revid );
113  $this->addFieldsIf( 'ar_user_text', $fld_user );
114  $this->addFieldsIf( 'ar_user', $fld_userid );
115  $this->addFieldsIf( 'ar_comment', $fld_comment || $fld_parsedcomment );
116  $this->addFieldsIf( 'ar_minor_edit', $fld_minor );
117  $this->addFieldsIf( 'ar_len', $fld_len );
118  $this->addFieldsIf( 'ar_sha1', $fld_sha1 );
119 
120  if ( $fld_tags ) {
121  $this->addTables( 'tag_summary' );
122  $this->addJoinConds(
123  array( 'tag_summary' => array( 'LEFT JOIN', array( 'ar_rev_id=ts_rev_id' ) ) )
124  );
125  $this->addFields( 'ts_tags' );
126  }
127 
128  if ( !is_null( $params['tag'] ) ) {
129  $this->addTables( 'change_tag' );
130  $this->addJoinConds(
131  array( 'change_tag' => array( 'INNER JOIN', array( 'ar_rev_id=ct_rev_id' ) ) )
132  );
133  $this->addWhereFld( 'ct_tag', $params['tag'] );
134  }
135 
136  if ( $fld_content ) {
137  $this->addTables( 'text' );
138  $this->addJoinConds(
139  array( 'text' => array( 'INNER JOIN', array( 'ar_text_id=old_id' ) ) )
140  );
141  $this->addFields( array( 'ar_text', 'ar_text_id', 'old_text', 'old_flags' ) );
142 
143  // This also means stricter restrictions
144  if ( !$user->isAllowedAny( 'undelete', 'deletedtext' ) ) {
145  $this->dieUsage(
146  'You don\'t have permission to view deleted revision content',
147  'permissiondenied'
148  );
149  }
150  }
151  // Check limits
152  $userMax = $fld_content ? ApiBase::LIMIT_SML1 : ApiBase::LIMIT_BIG1;
153  $botMax = $fld_content ? ApiBase::LIMIT_SML2 : ApiBase::LIMIT_BIG2;
154 
155  $limit = $params['limit'];
156 
157  if ( $limit == 'max' ) {
158  $limit = $this->getMain()->canApiHighLimits() ? $botMax : $userMax;
159  $this->getResult()->setParsedLimit( $this->getModuleName(), $limit );
160  }
161 
162  $this->validateLimit( 'limit', $limit, 1, $userMax, $botMax );
163 
164  if ( $fld_token ) {
165  // Undelete tokens are identical for all pages, so we cache one here
166  $token = $user->getEditToken( '', $this->getMain()->getRequest() );
167  }
168 
169  $dir = $params['dir'];
170 
171  // We need a custom WHERE clause that matches all titles.
172  if ( $mode == 'revs' ) {
173  $lb = new LinkBatch( $titles );
174  $where = $lb->constructSet( 'ar', $db );
175  $this->addWhere( $where );
176  } elseif ( $mode == 'all' ) {
177  $this->addWhereFld( 'ar_namespace', $params['namespace'] );
178 
179  $from = $params['from'] === null
180  ? null
181  : $this->titlePartToKey( $params['from'], $params['namespace'] );
182  $to = $params['to'] === null
183  ? null
184  : $this->titlePartToKey( $params['to'], $params['namespace'] );
185  $this->addWhereRange( 'ar_title', $dir, $from, $to );
186 
187  if ( isset( $params['prefix'] ) ) {
188  $this->addWhere( 'ar_title' . $db->buildLike(
189  $this->titlePartToKey( $params['prefix'], $params['namespace'] ),
190  $db->anyString() ) );
191  }
192  }
193 
194  if ( !is_null( $params['user'] ) ) {
195  $this->addWhereFld( 'ar_user_text', $params['user'] );
196  } elseif ( !is_null( $params['excludeuser'] ) ) {
197  $this->addWhere( 'ar_user_text != ' .
198  $db->addQuotes( $params['excludeuser'] ) );
199  }
200 
201  if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {
202  // Paranoia: avoid brute force searches (bug 17342)
203  // (shouldn't be able to get here without 'deletedhistory', but
204  // check it again just in case)
205  if ( !$user->isAllowed( 'deletedhistory' ) ) {
206  $bitmask = Revision::DELETED_USER;
207  } elseif ( !$user->isAllowed( 'suppressrevision' ) ) {
209  } else {
210  $bitmask = 0;
211  }
212  if ( $bitmask ) {
213  $this->addWhere( $db->bitAnd( 'ar_deleted', $bitmask ) . " != $bitmask" );
214  }
215  }
216 
217  if ( !is_null( $params['continue'] ) ) {
218  $cont = explode( '|', $params['continue'] );
219  $op = ( $dir == 'newer' ? '>' : '<' );
220  if ( $mode == 'all' || $mode == 'revs' ) {
221  $this->dieContinueUsageIf( count( $cont ) != 4 );
222  $ns = intval( $cont[0] );
223  $this->dieContinueUsageIf( strval( $ns ) !== $cont[0] );
224  $title = $db->addQuotes( $cont[1] );
225  $ts = $db->addQuotes( $db->timestamp( $cont[2] ) );
226  $ar_id = (int)$cont[3];
227  $this->dieContinueUsageIf( strval( $ar_id ) !== $cont[3] );
228  $this->addWhere( "ar_namespace $op $ns OR " .
229  "(ar_namespace = $ns AND " .
230  "(ar_title $op $title OR " .
231  "(ar_title = $title AND " .
232  "(ar_timestamp $op $ts OR " .
233  "(ar_timestamp = $ts AND " .
234  "ar_id $op= $ar_id)))))" );
235  } else {
236  $this->dieContinueUsageIf( count( $cont ) != 2 );
237  $ts = $db->addQuotes( $db->timestamp( $cont[0] ) );
238  $ar_id = (int)$cont[1];
239  $this->dieContinueUsageIf( strval( $ar_id ) !== $cont[1] );
240  $this->addWhere( "ar_timestamp $op $ts OR " .
241  "(ar_timestamp = $ts AND " .
242  "ar_id $op= $ar_id)" );
243  }
244  }
245 
246  $this->addOption( 'LIMIT', $limit + 1 );
247  $this->addOption(
248  'USE INDEX',
249  array( 'archive' => ( $mode == 'user' ? 'usertext_timestamp' : 'name_title_timestamp' ) )
250  );
251  if ( $mode == 'all' ) {
252  if ( $params['unique'] ) {
253  // @todo Does this work on non-MySQL?
254  $this->addOption( 'GROUP BY', 'ar_title' );
255  } else {
256  $sort = ( $dir == 'newer' ? '' : ' DESC' );
257  $this->addOption( 'ORDER BY', array(
258  'ar_title' . $sort,
259  'ar_timestamp' . $sort,
260  'ar_id' . $sort,
261  ) );
262  }
263  } else {
264  if ( $mode == 'revs' ) {
265  // Sort by ns and title in the same order as timestamp for efficiency
266  $this->addWhereRange( 'ar_namespace', $dir, null, null );
267  $this->addWhereRange( 'ar_title', $dir, null, null );
268  }
269  $this->addTimestampWhereRange( 'ar_timestamp', $dir, $params['start'], $params['end'] );
270  // Include in ORDER BY for uniqueness
271  $this->addWhereRange( 'ar_id', $dir, null, null );
272  }
273  $res = $this->select( __METHOD__ );
274  $pageMap = array(); // Maps ns&title to (fake) pageid
275  $count = 0;
276  $newPageID = 0;
277  foreach ( $res as $row ) {
278  if ( ++$count > $limit ) {
279  // We've had enough
280  if ( $mode == 'all' || $mode == 'revs' ) {
281  $this->setContinueEnumParameter( 'continue',
282  "$row->ar_namespace|$row->ar_title|$row->ar_timestamp|$row->ar_id"
283  );
284  } else {
285  $this->setContinueEnumParameter( 'continue', "$row->ar_timestamp|$row->ar_id" );
286  }
287  break;
288  }
289 
290  $rev = array();
291  $anyHidden = false;
292 
293  $rev['timestamp'] = wfTimestamp( TS_ISO_8601, $row->ar_timestamp );
294  if ( $fld_revid ) {
295  $rev['revid'] = intval( $row->ar_rev_id );
296  }
297  if ( $fld_parentid && !is_null( $row->ar_parent_id ) ) {
298  $rev['parentid'] = intval( $row->ar_parent_id );
299  }
300  if ( $fld_user || $fld_userid ) {
301  if ( $row->ar_deleted & Revision::DELETED_USER ) {
302  $rev['userhidden'] = '';
303  $anyHidden = true;
304  }
305  if ( Revision::userCanBitfield( $row->ar_deleted, Revision::DELETED_USER, $user ) ) {
306  if ( $fld_user ) {
307  $rev['user'] = $row->ar_user_text;
308  }
309  if ( $fld_userid ) {
310  $rev['userid'] = $row->ar_user;
311  }
312  }
313  }
314 
315  if ( $fld_comment || $fld_parsedcomment ) {
316  if ( $row->ar_deleted & Revision::DELETED_COMMENT ) {
317  $rev['commenthidden'] = '';
318  $anyHidden = true;
319  }
320  if ( Revision::userCanBitfield( $row->ar_deleted, Revision::DELETED_COMMENT, $user ) ) {
321  if ( $fld_comment ) {
322  $rev['comment'] = $row->ar_comment;
323  }
324  if ( $fld_parsedcomment ) {
325  $title = Title::makeTitle( $row->ar_namespace, $row->ar_title );
326  $rev['parsedcomment'] = Linker::formatComment( $row->ar_comment, $title );
327  }
328  }
329  }
330 
331  if ( $fld_minor && $row->ar_minor_edit == 1 ) {
332  $rev['minor'] = '';
333  }
334  if ( $fld_len ) {
335  $rev['len'] = $row->ar_len;
336  }
337  if ( $fld_sha1 ) {
338  if ( $row->ar_deleted & Revision::DELETED_TEXT ) {
339  $rev['sha1hidden'] = '';
340  $anyHidden = true;
341  }
342  if ( Revision::userCanBitfield( $row->ar_deleted, Revision::DELETED_TEXT, $user ) ) {
343  if ( $row->ar_sha1 != '' ) {
344  $rev['sha1'] = wfBaseConvert( $row->ar_sha1, 36, 16, 40 );
345  } else {
346  $rev['sha1'] = '';
347  }
348  }
349  }
350  if ( $fld_content ) {
351  if ( $row->ar_deleted & Revision::DELETED_TEXT ) {
352  $rev['texthidden'] = '';
353  $anyHidden = true;
354  }
355  if ( Revision::userCanBitfield( $row->ar_deleted, Revision::DELETED_TEXT, $user ) ) {
357  }
358  }
359 
360  if ( $fld_tags ) {
361  if ( $row->ts_tags ) {
362  $tags = explode( ',', $row->ts_tags );
363  $this->getResult()->setIndexedTagName( $tags, 'tag' );
364  $rev['tags'] = $tags;
365  } else {
366  $rev['tags'] = array();
367  }
368  }
369 
370  if ( $anyHidden && ( $row->ar_deleted & Revision::DELETED_RESTRICTED ) ) {
371  $rev['suppressed'] = '';
372  }
373 
374  if ( !isset( $pageMap[$row->ar_namespace][$row->ar_title] ) ) {
375  $pageID = $newPageID++;
376  $pageMap[$row->ar_namespace][$row->ar_title] = $pageID;
377  $a['revisions'] = array( $rev );
378  $result->setIndexedTagName( $a['revisions'], 'rev' );
379  $title = Title::makeTitle( $row->ar_namespace, $row->ar_title );
381  if ( $fld_token ) {
382  $a['token'] = $token;
383  }
384  $fit = $result->addValue( array( 'query', $this->getModuleName() ), $pageID, $a );
385  } else {
386  $pageID = $pageMap[$row->ar_namespace][$row->ar_title];
387  $fit = $result->addValue(
388  array( 'query', $this->getModuleName(), $pageID, 'revisions' ),
389  null, $rev );
390  }
391  if ( !$fit ) {
392  if ( $mode == 'all' || $mode == 'revs' ) {
393  $this->setContinueEnumParameter( 'continue',
394  "$row->ar_namespace|$row->ar_title|$row->ar_timestamp|$row->ar_id"
395  );
396  } else {
397  $this->setContinueEnumParameter( 'continue', "$row->ar_timestamp|$row->ar_id" );
398  }
399  break;
400  }
401  }
402  $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'page' );
403  }
404 
405  public function getAllowedParams() {
406  return array(
407  'start' => array(
408  ApiBase::PARAM_TYPE => 'timestamp'
409  ),
410  'end' => array(
411  ApiBase::PARAM_TYPE => 'timestamp',
412  ),
413  'dir' => array(
415  'newer',
416  'older'
417  ),
418  ApiBase::PARAM_DFLT => 'older'
419  ),
420  'from' => null,
421  'to' => null,
422  'prefix' => null,
423  'continue' => null,
424  'unique' => false,
425  'tag' => null,
426  'user' => array(
427  ApiBase::PARAM_TYPE => 'user'
428  ),
429  'excludeuser' => array(
430  ApiBase::PARAM_TYPE => 'user'
431  ),
432  'namespace' => array(
433  ApiBase::PARAM_TYPE => 'namespace',
435  ),
436  'limit' => array(
437  ApiBase::PARAM_DFLT => 10,
438  ApiBase::PARAM_TYPE => 'limit',
439  ApiBase::PARAM_MIN => 1,
442  ),
443  'prop' => array(
444  ApiBase::PARAM_DFLT => 'user|comment',
446  'revid',
447  'parentid',
448  'user',
449  'userid',
450  'comment',
451  'parsedcomment',
452  'minor',
453  'len',
454  'sha1',
455  'content',
456  'token',
457  'tags'
458  ),
459  ApiBase::PARAM_ISMULTI => true
460  ),
461  );
462  }
463 
464  public function getParamDescription() {
465  return array(
466  'start' => 'The timestamp to start enumerating from (1, 2)',
467  'end' => 'The timestamp to stop enumerating at (1, 2)',
468  'dir' => $this->getDirectionDescription( $this->getModulePrefix(), ' (1, 3)' ),
469  'from' => 'Start listing at this title (3)',
470  'to' => 'Stop listing at this title (3)',
471  'prefix' => 'Search for all page titles that begin with this value (3)',
472  'limit' => 'The maximum amount of revisions to list',
473  'prop' => array(
474  'Which properties to get',
475  ' revid - Adds the revision ID of the deleted revision',
476  ' parentid - Adds the revision ID of the previous revision to the page',
477  ' user - Adds the user who made the revision',
478  ' userid - Adds the user ID whom made the revision',
479  ' comment - Adds the comment of the revision',
480  ' parsedcomment - Adds the parsed comment of the revision',
481  ' minor - Tags if the revision is minor',
482  ' len - Adds the length (bytes) of the revision',
483  ' sha1 - Adds the SHA-1 (base 16) of the revision',
484  ' content - Adds the content of the revision',
485  ' token - Gives the edit token',
486  ' tags - Tags for the revision',
487  ),
488  'namespace' => 'Only list pages in this namespace (3)',
489  'user' => 'Only list revisions by this user',
490  'excludeuser' => 'Don\'t list revisions by this user',
491  'continue' => 'When more results are available, use this to continue',
492  'unique' => 'List only one revision for each page (3)',
493  'tag' => 'Only list revisions tagged with this tag',
494  );
495  }
496 
497  public function getResultProperties() {
498  return array(
499  '' => array(
500  'ns' => 'namespace',
501  'title' => 'string'
502  ),
503  'token' => array(
504  'token' => 'string'
505  )
506  );
507  }
508 
509  public function getDescription() {
510  $p = $this->getModulePrefix();
511 
512  return array(
513  'List deleted revisions.',
514  'Operates in three modes:',
515  ' 1) List deleted revisions for the given title(s), sorted by timestamp.',
516  ' 2) List deleted contributions for the given user, sorted by timestamp (no titles specified).',
517  ' 3) List all deleted revisions in the given namespace, sorted by title and timestamp',
518  " (no titles specified, {$p}user not set).",
519  'Certain parameters only apply to some modes and are ignored in others.',
520  'For instance, a parameter marked (1) only applies to mode 1 and is ignored in modes 2 and 3.',
521  );
522  }
523 
524  public function getPossibleErrors() {
525  return array_merge( parent::getPossibleErrors(), array(
526  array(
527  'code' => 'permissiondenied',
528  'info' => 'You don\'t have permission to view deleted revision information'
529  ),
530  array( 'code' => 'badparams', 'info' => 'user and excludeuser cannot be used together'
531  ),
532  array(
533  'code' => 'permissiondenied',
534  'info' => 'You don\'t have permission to view deleted revision content'
535  ),
536  array( 'code' => 'badparams', 'info' => "The 'from' parameter cannot be used in modes 1 or 2" ),
537  array( 'code' => 'badparams', 'info' => "The 'to' parameter cannot be used in modes 1 or 2" ),
538  array(
539  'code' => 'badparams',
540  'info' => "The 'prefix' parameter cannot be used in modes 1 or 2"
541  ),
542  array( 'code' => 'badparams', 'info' => "The 'start' parameter cannot be used in mode 3" ),
543  array( 'code' => 'badparams', 'info' => "The 'end' parameter cannot be used in mode 3" ),
544  ) );
545  }
546 
547  public function getExamples() {
548  return array(
549  'api.php?action=query&list=deletedrevs&titles=Main%20Page|Talk:Main%20Page&' .
550  'drprop=user|comment|content'
551  => 'List the last deleted revisions of Main Page and Talk:Main Page, with content (mode 1)',
552  'api.php?action=query&list=deletedrevs&druser=Bob&drlimit=50'
553  => 'List the last 50 deleted contributions by Bob (mode 2)',
554  'api.php?action=query&list=deletedrevs&drdir=newer&drlimit=50'
555  => 'List the first 50 deleted revisions in the main namespace (mode 3)',
556  'api.php?action=query&list=deletedrevs&drdir=newer&drlimit=50&drnamespace=1&drunique='
557  => 'List the first 50 deleted pages in the Talk namespace (mode 3):',
558  );
559  }
560 
561  public function getHelpUrls() {
562  return 'https://www.mediawiki.org/wiki/API:Deletedrevs';
563  }
564 }
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
$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
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
LinkBatch
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition: LinkBatch.php:30
ApiResult\setContent
static setContent(&$arr, $value, $subElemName=null)
Adds a content element to an array.
Definition: ApiResult.php:201
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
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
$from
$from
Definition: importImages.php:90
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
Revision\getRevisionText
static getRevisionText( $row, $prefix='old_', $wiki=false)
Get revision text associated with an old or archive row $row is usually an object from wfFetchRow(),...
Definition: Revision.php:1212
ContextSource\getRequest
getRequest()
Get the WebRequest object.
Definition: ContextSource.php:77
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
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:132
ApiQueryBase\addFieldsIf
addFieldsIf( $value, $condition)
Same as addFields(), but add the fields only if a condition is met.
Definition: ApiQueryBase.php:131
NS_MAIN
const NS_MAIN
Definition: Defines.php:79
ApiBase\PARAM_MIN
const PARAM_MIN
Definition: ApiBase.php:56
$lb
if( $wgAPIRequestLog) $lb
Definition: api.php:126
$titles
linkcache txt The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database This is used to mark up links when displaying a page If the same link appears more than once on any page then it only has to be looked up once In most cases link lookups are done in batches with the LinkBatch class or the equivalent in so the link cache is mostly useful for short snippets of parsed and for links in the navigation areas of the skin The link cache was formerly used to track links used in a document for the purposes of updating the link tables This application is now deprecated To create a you can use the following $titles
Definition: linkcache.txt:17
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
ApiQueryDeletedrevs\getExamples
getExamples()
Returns usage examples for this module.
Definition: ApiQueryDeletedrevs.php:547
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.
$sort
$sort
Definition: profileinfo.php:301
ApiQueryBase\$where
$where
Definition: ApiQueryBase.php:36
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
ApiBase\dieContinueUsageIf
dieContinueUsageIf( $condition)
Die with the $prefix.
Definition: ApiBase.php:1969
ApiBase\LIMIT_SML2
const LIMIT_SML2
Definition: ApiBase.php:81
ApiQueryDeletedrevs\execute
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
Definition: ApiQueryDeletedrevs.php:38
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
ApiQueryBase\addJoinConds
addJoinConds( $join_conds)
Add a set of JOIN conditions to the internal array.
Definition: ApiQueryBase.php:106
ApiQueryBase\titlePartToKey
titlePartToKey( $titlePart, $defaultNamespace=NS_MAIN)
An alternative to titleToKey() that doesn't trim trailing spaces, and does not mangle the input if st...
Definition: ApiQueryBase.php:491
ApiQueryBase\addWhereFld
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
Definition: ApiQueryBase.php:185
ApiQueryDeletedrevs\getPossibleErrors
getPossibleErrors()
Definition: ApiQueryDeletedrevs.php:524
ApiQueryBase\getPageSet
getPageSet()
Get the PageSet object to work on.
Definition: ApiQueryBase.php:441
$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
ApiQueryDeletedrevs\getAllowedParams
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Definition: ApiQueryDeletedrevs.php:405
$rev
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
Definition: hooks.txt:1337
ApiBase\LIMIT_BIG2
const LIMIT_BIG2
Definition: ApiBase.php:79
$dir
if(count( $args)==0) $dir
Definition: importImages.php:49
wfBaseConvert
wfBaseConvert( $input, $sourceBase, $destBase, $pad=1, $lowercase=true, $engine='auto')
Convert an arbitrarily-long digit string from one numeric base to another, optionally zero-padding to...
Definition: GlobalFunctions.php:3424
ApiBase\validateLimit
validateLimit( $paramName, &$value, $min, $max, $botMax=null, $enforceLimits=false)
Validate the value against the minimum and user/bot maximum limits.
Definition: ApiBase.php:1253
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
ApiBase\PARAM_MAX2
const PARAM_MAX2
Definition: ApiBase.php:54
ApiQueryDeletedrevs\getParamDescription
getParamDescription()
Returns an array of parameter descriptions.
Definition: ApiQueryDeletedrevs.php:464
ApiBase\getMain
getMain()
Get the main module.
Definition: ApiBase.php:188
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
$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
ApiQueryDeletedrevs\getHelpUrls
getHelpUrls()
Definition: ApiQueryDeletedrevs.php:561
$res
$res
Definition: database.txt:21
ApiQueryDeletedrevs\getDescription
getDescription()
Returns the description string for this module.
Definition: ApiQueryDeletedrevs.php:509
Revision\DELETED_TEXT
const DELETED_TEXT
Definition: Revision.php:65
ApiQueryDeletedrevs
Query module to enumerate all deleted revisions.
Definition: ApiQueryDeletedrevs.php:32
ApiQueryDeletedrevs\getResultProperties
getResultProperties()
Returns possible properties in the result, grouped by the value of the prop parameter that shows them...
Definition: ApiQueryDeletedrevs.php:497
ApiQueryBase\addTitleInfo
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
Definition: ApiQueryBase.php:339
ApiBase\LIMIT_SML1
const LIMIT_SML1
Definition: ApiBase.php:80
ApiQueryDeletedrevs\__construct
__construct( $query, $moduleName)
Definition: ApiQueryDeletedrevs.php:34