MediaWiki  1.33.0
ApiQueryAllDeletedRevisions.php
Go to the documentation of this file.
1 <?php
29 
36 
37  public function __construct( ApiQuery $query, $moduleName ) {
38  parent::__construct( $query, $moduleName, 'adr' );
39  }
40 
45  protected function run( ApiPageSet $resultPageSet = null ) {
46  // Before doing anything at all, let's check permissions
47  $this->checkUserRightsAny( 'deletedhistory' );
48 
49  $user = $this->getUser();
50  $db = $this->getDB();
51  $params = $this->extractRequestParams( false );
52  $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
53 
54  $result = $this->getResult();
55 
56  // If the user wants no namespaces, they get no pages.
57  if ( $params['namespace'] === [] ) {
58  if ( $resultPageSet === null ) {
59  $result->addValue( 'query', $this->getModuleName(), [] );
60  }
61  return;
62  }
63 
64  // This module operates in two modes:
65  // 'user': List deleted revs by a certain user
66  // 'all': List all deleted revs in NS
67  $mode = 'all';
68  if ( !is_null( $params['user'] ) ) {
69  $mode = 'user';
70  }
71 
72  if ( $mode == 'user' ) {
73  foreach ( [ 'from', 'to', 'prefix', 'excludeuser' ] as $param ) {
74  if ( !is_null( $params[$param] ) ) {
75  $p = $this->getModulePrefix();
76  $this->dieWithError(
77  [ 'apierror-invalidparammix-cannotusewith', $p . $param, "{$p}user" ],
78  'invalidparammix'
79  );
80  }
81  }
82  } else {
83  foreach ( [ 'start', 'end' ] as $param ) {
84  if ( !is_null( $params[$param] ) ) {
85  $p = $this->getModulePrefix();
86  $this->dieWithError(
87  [ 'apierror-invalidparammix-mustusewith', $p . $param, "{$p}user" ],
88  'invalidparammix'
89  );
90  }
91  }
92  }
93 
94  // If we're generating titles only, we can use DISTINCT for a better
95  // query. But we can't do that in 'user' mode (wrong index), and we can
96  // only do it when sorting ASC (because MySQL apparently can't use an
97  // index backwards for grouping even though it can for ORDER BY, WTF?)
98  $dir = $params['dir'];
99  $optimizeGenerateTitles = false;
100  if ( $mode === 'all' && $params['generatetitles'] && $resultPageSet !== null ) {
101  if ( $dir === 'newer' ) {
102  $optimizeGenerateTitles = true;
103  } else {
104  $p = $this->getModulePrefix();
105  $this->addWarning( [ 'apiwarn-alldeletedrevisions-performance', $p ], 'performance' );
106  }
107  }
108 
109  if ( $resultPageSet === null ) {
110  $this->parseParameters( $params );
111  $arQuery = $revisionStore->getArchiveQueryInfo();
112  $this->addTables( $arQuery['tables'] );
113  $this->addJoinConds( $arQuery['joins'] );
114  $this->addFields( $arQuery['fields'] );
115  $this->addFields( [ 'ar_title', 'ar_namespace' ] );
116  } else {
117  $this->limit = $this->getParameter( 'limit' ) ?: 10;
118  $this->addTables( 'archive' );
119  $this->addFields( [ 'ar_title', 'ar_namespace' ] );
120  if ( $optimizeGenerateTitles ) {
121  $this->addOption( 'DISTINCT' );
122  } else {
123  $this->addFields( [ 'ar_timestamp', 'ar_rev_id', 'ar_id' ] );
124  }
125  }
126 
127  if ( $this->fld_tags ) {
128  $this->addFields( [ 'ts_tags' => ChangeTags::makeTagSummarySubquery( 'archive' ) ] );
129  }
130 
131  if ( !is_null( $params['tag'] ) ) {
132  $this->addTables( 'change_tag' );
133  $this->addJoinConds(
134  [ 'change_tag' => [ 'JOIN', [ 'ar_rev_id=ct_rev_id' ] ] ]
135  );
136  $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore();
137  try {
138  $this->addWhereFld( 'ct_tag_id', $changeTagDefStore->getId( $params['tag'] ) );
139  } catch ( NameTableAccessException $exception ) {
140  // Return nothing.
141  $this->addWhere( '1=0' );
142  }
143  }
144 
145  if ( $this->fetchContent ) {
146  $this->addTables( 'text' );
147  $this->addJoinConds(
148  [ 'text' => [ 'LEFT JOIN', [ 'ar_text_id=old_id' ] ] ]
149  );
150  $this->addFields( [ 'old_text', 'old_flags' ] );
151 
152  // This also means stricter restrictions
153  $this->checkUserRightsAny( [ 'deletedtext', 'undelete' ] );
154  }
155 
156  $miser_ns = null;
157 
158  if ( $mode == 'all' ) {
160  $this->addWhereFld( 'ar_namespace', $namespaces );
161 
162  // For from/to/prefix, we have to consider the potential
163  // transformations of the title in all specified namespaces.
164  // Generally there will be only one transformation, but wikis with
165  // some namespaces case-sensitive could have two.
166  if ( $params['from'] !== null || $params['to'] !== null ) {
167  $isDirNewer = ( $dir === 'newer' );
168  $after = ( $isDirNewer ? '>=' : '<=' );
169  $before = ( $isDirNewer ? '<=' : '>=' );
170  $where = [];
171  foreach ( $namespaces as $ns ) {
172  $w = [];
173  if ( $params['from'] !== null ) {
174  $w[] = 'ar_title' . $after .
175  $db->addQuotes( $this->titlePartToKey( $params['from'], $ns ) );
176  }
177  if ( $params['to'] !== null ) {
178  $w[] = 'ar_title' . $before .
179  $db->addQuotes( $this->titlePartToKey( $params['to'], $ns ) );
180  }
181  $w = $db->makeList( $w, LIST_AND );
182  $where[$w][] = $ns;
183  }
184  if ( count( $where ) == 1 ) {
185  $where = key( $where );
186  $this->addWhere( $where );
187  } else {
188  $where2 = [];
189  foreach ( $where as $w => $ns ) {
190  $where2[] = $db->makeList( [ $w, 'ar_namespace' => $ns ], LIST_AND );
191  }
192  $this->addWhere( $db->makeList( $where2, LIST_OR ) );
193  }
194  }
195 
196  if ( isset( $params['prefix'] ) ) {
197  $where = [];
198  foreach ( $namespaces as $ns ) {
199  $w = 'ar_title' . $db->buildLike(
200  $this->titlePartToKey( $params['prefix'], $ns ),
201  $db->anyString() );
202  $where[$w][] = $ns;
203  }
204  if ( count( $where ) == 1 ) {
205  $where = key( $where );
206  $this->addWhere( $where );
207  } else {
208  $where2 = [];
209  foreach ( $where as $w => $ns ) {
210  $where2[] = $db->makeList( [ $w, 'ar_namespace' => $ns ], LIST_AND );
211  }
212  $this->addWhere( $db->makeList( $where2, LIST_OR ) );
213  }
214  }
215  } else {
216  if ( $this->getConfig()->get( 'MiserMode' ) ) {
217  $miser_ns = $params['namespace'];
218  } else {
219  $this->addWhereFld( 'ar_namespace', $params['namespace'] );
220  }
221  $this->addTimestampWhereRange( 'ar_timestamp', $dir, $params['start'], $params['end'] );
222  }
223 
224  if ( !is_null( $params['user'] ) ) {
225  // Don't query by user ID here, it might be able to use the ar_usertext_timestamp index.
226  $actorQuery = ActorMigration::newMigration()
227  ->getWhere( $db, 'ar_user', User::newFromName( $params['user'], false ), false );
228  $this->addTables( $actorQuery['tables'] );
229  $this->addJoinConds( $actorQuery['joins'] );
230  $this->addWhere( $actorQuery['conds'] );
231  } elseif ( !is_null( $params['excludeuser'] ) ) {
232  // Here there's no chance of using ar_usertext_timestamp.
233  $actorQuery = ActorMigration::newMigration()
234  ->getWhere( $db, 'ar_user', User::newFromName( $params['excludeuser'], false ) );
235  $this->addTables( $actorQuery['tables'] );
236  $this->addJoinConds( $actorQuery['joins'] );
237  $this->addWhere( 'NOT(' . $actorQuery['conds'] . ')' );
238  }
239 
240  if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {
241  // Paranoia: avoid brute force searches (T19342)
242  // (shouldn't be able to get here without 'deletedhistory', but
243  // check it again just in case)
244  if ( !$user->isAllowed( 'deletedhistory' ) ) {
245  $bitmask = RevisionRecord::DELETED_USER;
246  } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
247  $bitmask = RevisionRecord::DELETED_USER | RevisionRecord::DELETED_RESTRICTED;
248  } else {
249  $bitmask = 0;
250  }
251  if ( $bitmask ) {
252  $this->addWhere( $db->bitAnd( 'ar_deleted', $bitmask ) . " != $bitmask" );
253  }
254  }
255 
256  if ( !is_null( $params['continue'] ) ) {
257  $cont = explode( '|', $params['continue'] );
258  $op = ( $dir == 'newer' ? '>' : '<' );
259  if ( $optimizeGenerateTitles ) {
260  $this->dieContinueUsageIf( count( $cont ) != 2 );
261  $ns = (int)$cont[0];
262  $this->dieContinueUsageIf( strval( $ns ) !== $cont[0] );
263  $title = $db->addQuotes( $cont[1] );
264  $this->addWhere( "ar_namespace $op $ns OR " .
265  "(ar_namespace = $ns AND ar_title $op= $title)" );
266  } elseif ( $mode == 'all' ) {
267  $this->dieContinueUsageIf( count( $cont ) != 4 );
268  $ns = (int)$cont[0];
269  $this->dieContinueUsageIf( strval( $ns ) !== $cont[0] );
270  $title = $db->addQuotes( $cont[1] );
271  $ts = $db->addQuotes( $db->timestamp( $cont[2] ) );
272  $ar_id = (int)$cont[3];
273  $this->dieContinueUsageIf( strval( $ar_id ) !== $cont[3] );
274  $this->addWhere( "ar_namespace $op $ns OR " .
275  "(ar_namespace = $ns AND " .
276  "(ar_title $op $title OR " .
277  "(ar_title = $title AND " .
278  "(ar_timestamp $op $ts OR " .
279  "(ar_timestamp = $ts AND " .
280  "ar_id $op= $ar_id)))))" );
281  } else {
282  $this->dieContinueUsageIf( count( $cont ) != 2 );
283  $ts = $db->addQuotes( $db->timestamp( $cont[0] ) );
284  $ar_id = (int)$cont[1];
285  $this->dieContinueUsageIf( strval( $ar_id ) !== $cont[1] );
286  $this->addWhere( "ar_timestamp $op $ts OR " .
287  "(ar_timestamp = $ts AND " .
288  "ar_id $op= $ar_id)" );
289  }
290  }
291 
292  $this->addOption( 'LIMIT', $this->limit + 1 );
293 
294  $sort = ( $dir == 'newer' ? '' : ' DESC' );
295  $orderby = [];
296  if ( $optimizeGenerateTitles ) {
297  // Targeting index name_title_timestamp
298  if ( $params['namespace'] === null || count( array_unique( $params['namespace'] ) ) > 1 ) {
299  $orderby[] = "ar_namespace $sort";
300  }
301  $orderby[] = "ar_title $sort";
302  } elseif ( $mode == 'all' ) {
303  // Targeting index name_title_timestamp
304  if ( $params['namespace'] === null || count( array_unique( $params['namespace'] ) ) > 1 ) {
305  $orderby[] = "ar_namespace $sort";
306  }
307  $orderby[] = "ar_title $sort";
308  $orderby[] = "ar_timestamp $sort";
309  $orderby[] = "ar_id $sort";
310  } else {
311  // Targeting index usertext_timestamp
312  // 'user' is always constant.
313  $orderby[] = "ar_timestamp $sort";
314  $orderby[] = "ar_id $sort";
315  }
316  $this->addOption( 'ORDER BY', $orderby );
317 
318  $res = $this->select( __METHOD__ );
319  $pageMap = []; // Maps ns&title to array index
320  $count = 0;
321  $nextIndex = 0;
322  $generated = [];
323  foreach ( $res as $row ) {
324  if ( ++$count > $this->limit ) {
325  // We've had enough
326  if ( $optimizeGenerateTitles ) {
327  $this->setContinueEnumParameter( 'continue', "$row->ar_namespace|$row->ar_title" );
328  } elseif ( $mode == 'all' ) {
329  $this->setContinueEnumParameter( 'continue',
330  "$row->ar_namespace|$row->ar_title|$row->ar_timestamp|$row->ar_id"
331  );
332  } else {
333  $this->setContinueEnumParameter( 'continue', "$row->ar_timestamp|$row->ar_id" );
334  }
335  break;
336  }
337 
338  // Miser mode namespace check
339  if ( $miser_ns !== null && !in_array( $row->ar_namespace, $miser_ns ) ) {
340  continue;
341  }
342 
343  if ( $resultPageSet !== null ) {
344  if ( $params['generatetitles'] ) {
345  $key = "{$row->ar_namespace}:{$row->ar_title}";
346  if ( !isset( $generated[$key] ) ) {
347  $generated[$key] = Title::makeTitle( $row->ar_namespace, $row->ar_title );
348  }
349  } else {
350  $generated[] = $row->ar_rev_id;
351  }
352  } else {
353  $revision = $revisionStore->newRevisionFromArchiveRow( $row );
354  $rev = $this->extractRevisionInfo( $revision, $row );
355 
356  if ( !isset( $pageMap[$row->ar_namespace][$row->ar_title] ) ) {
357  $index = $nextIndex++;
358  $pageMap[$row->ar_namespace][$row->ar_title] = $index;
359  $title = Title::newFromLinkTarget( $revision->getPageAsLinkTarget() );
360  $a = [
361  'pageid' => $title->getArticleID(),
362  'revisions' => [ $rev ],
363  ];
364  ApiResult::setIndexedTagName( $a['revisions'], 'rev' );
366  $fit = $result->addValue( [ 'query', $this->getModuleName() ], $index, $a );
367  } else {
368  $index = $pageMap[$row->ar_namespace][$row->ar_title];
369  $fit = $result->addValue(
370  [ 'query', $this->getModuleName(), $index, 'revisions' ],
371  null, $rev );
372  }
373  if ( !$fit ) {
374  if ( $mode == 'all' ) {
375  $this->setContinueEnumParameter( 'continue',
376  "$row->ar_namespace|$row->ar_title|$row->ar_timestamp|$row->ar_id"
377  );
378  } else {
379  $this->setContinueEnumParameter( 'continue', "$row->ar_timestamp|$row->ar_id" );
380  }
381  break;
382  }
383  }
384  }
385 
386  if ( $resultPageSet !== null ) {
387  if ( $params['generatetitles'] ) {
388  $resultPageSet->populateFromTitles( $generated );
389  } else {
390  $resultPageSet->populateFromRevisionIDs( $generated );
391  }
392  } else {
393  $result->addIndexedTagName( [ 'query', $this->getModuleName() ], 'page' );
394  }
395  }
396 
397  public function getAllowedParams() {
398  $ret = parent::getAllowedParams() + [
399  'user' => [
400  ApiBase::PARAM_TYPE => 'user'
401  ],
402  'namespace' => [
403  ApiBase::PARAM_ISMULTI => true,
404  ApiBase::PARAM_TYPE => 'namespace',
405  ],
406  'start' => [
407  ApiBase::PARAM_TYPE => 'timestamp',
408  ApiBase::PARAM_HELP_MSG_INFO => [ [ 'useronly' ] ],
409  ],
410  'end' => [
411  ApiBase::PARAM_TYPE => 'timestamp',
412  ApiBase::PARAM_HELP_MSG_INFO => [ [ 'useronly' ] ],
413  ],
414  'dir' => [
416  'newer',
417  'older'
418  ],
419  ApiBase::PARAM_DFLT => 'older',
420  ApiBase::PARAM_HELP_MSG => 'api-help-param-direction',
421  ],
422  'from' => [
423  ApiBase::PARAM_HELP_MSG_INFO => [ [ 'nonuseronly' ] ],
424  ],
425  'to' => [
426  ApiBase::PARAM_HELP_MSG_INFO => [ [ 'nonuseronly' ] ],
427  ],
428  'prefix' => [
429  ApiBase::PARAM_HELP_MSG_INFO => [ [ 'nonuseronly' ] ],
430  ],
431  'excludeuser' => [
432  ApiBase::PARAM_TYPE => 'user',
433  ApiBase::PARAM_HELP_MSG_INFO => [ [ 'nonuseronly' ] ],
434  ],
435  'tag' => null,
436  'continue' => [
437  ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
438  ],
439  'generatetitles' => [
441  ],
442  ];
443 
444  if ( $this->getConfig()->get( 'MiserMode' ) ) {
446  'apihelp-query+alldeletedrevisions-param-miser-user-namespace',
447  ];
448  $ret['namespace'][ApiBase::PARAM_HELP_MSG_APPEND] = [
449  'apihelp-query+alldeletedrevisions-param-miser-user-namespace',
450  ];
451  }
452 
453  return $ret;
454  }
455 
456  protected function getExamplesMessages() {
457  return [
458  'action=query&list=alldeletedrevisions&adruser=Example&adrlimit=50'
459  => 'apihelp-query+alldeletedrevisions-example-user',
460  'action=query&list=alldeletedrevisions&adrdir=newer&adrnamespace=0&adrlimit=50'
461  => 'apihelp-query+alldeletedrevisions-example-ns-main',
462  ];
463  }
464 
465  public function getHelpUrls() {
466  return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Alldeletedrevisions';
467  }
468 }
ApiQueryRevisionsBase\parseParameters
parseParameters( $params)
Parse the parameters into the various instance fields.
Definition: ApiQueryRevisionsBase.php:77
ContextSource\getConfig
getConfig()
Definition: ContextSource.php:63
ChangeTags\makeTagSummarySubquery
static makeTagSummarySubquery( $tables)
Make the tag summary subquery based on the given tables and return it.
Definition: ChangeTags.php:793
$user
return true to allow those checks to and false if checking is done & $user
Definition: hooks.txt:1476
ApiQueryBase\addFields
addFields( $value)
Add a set of fields to select to the internal array.
Definition: ApiQueryBase.php:190
ApiQuery
This is the main query class.
Definition: ApiQuery.php:36
Revision\RevisionRecord
Page revision base class.
Definition: RevisionRecord.php:45
ApiBase\addWarning
addWarning( $msg, $code=null, $data=null)
Add a warning for this module.
Definition: ApiBase.php:1909
false
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:187
MWNamespace\getValidNamespaces
static getValidNamespaces()
Returns an array of the namespaces (by integer id) that exist on the wiki.
Definition: MWNamespace.php:287
captcha-old.count
count
Definition: captcha-old.py:249
ApiBase\dieWithError
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
Definition: ApiBase.php:1990
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:335
ApiBase\PARAM_HELP_MSG
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
Definition: ApiBase.php:124
$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. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. '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 '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 '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 '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. '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 IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() '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 Sanitizer::validateEmail(), 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 '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:Array with elements of the form "language:title" in the order that they will be output. & $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. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead. 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:1983
$namespaces
namespace and then decline to actually register it & $namespaces
Definition: hooks.txt:925
ApiBase\PARAM_TYPE
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
Definition: ApiBase.php:87
ApiBase\getResult
getResult()
Get the result object.
Definition: ApiBase.php:632
ApiBase\checkUserRightsAny
checkUserRightsAny( $rights, $user=null)
Helper function for permission-denied errors.
Definition: ApiBase.php:2105
$params
$params
Definition: styleTest.css.php:44
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:585
$res
$res
Definition: database.txt:21
ApiQueryBase\addOption
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
Definition: ApiQueryBase.php:347
ContextSource\getUser
getUser()
Definition: ContextSource.php:120
ApiBase\PARAM_HELP_MSG_APPEND
const PARAM_HELP_MSG_APPEND
((string|array|Message)[]) Specify additional i18n messages to append to the normal message for this ...
Definition: ApiBase.php:131
ActorMigration\newMigration
static newMigration()
Static constructor.
Definition: ActorMigration.php:111
ApiPageSet
This class contains a list of pages that the client has requested.
Definition: ApiPageSet.php:40
php
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
LIST_AND
const LIST_AND
Definition: Defines.php:43
ApiQueryRevisionsBase
A base class for functions common to producing a list of revisions.
Definition: ApiQueryRevisionsBase.php:34
ApiQueryAllDeletedRevisions\getHelpUrls
getHelpUrls()
Return links to more detailed help pages about the module.
Definition: ApiQueryAllDeletedRevisions.php:465
ApiQueryGeneratorBase\setContinueEnumParameter
setContinueEnumParameter( $paramName, $paramValue)
Overridden to set the generator param if in generator mode.
Definition: ApiQueryGeneratorBase.php:84
$query
null for the 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:1588
LIST_OR
const LIST_OR
Definition: Defines.php:46
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:925
ApiQueryBase\getDB
getDB()
Get the Query database connection (read-only)
Definition: ApiQueryBase.php:105
ApiQueryAllDeletedRevisions\getAllowedParams
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Definition: ApiQueryAllDeletedRevisions.php:397
ApiQueryBase\addTables
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
Definition: ApiQueryBase.php:158
ApiQueryBase\select
select( $method, $extraQuery=[], array &$hookData=null)
Execute a SELECT query based on the values in the internal arrays.
Definition: ApiQueryBase.php:372
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
ApiBase\extractRequestParams
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
Definition: ApiBase.php:743
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:576
ApiQueryAllDeletedRevisions\getExamplesMessages
getExamplesMessages()
Returns usage examples for this module.
Definition: ApiQueryAllDeletedRevisions.php:456
$sort
$sort
Definition: profileinfo.php:328
ApiQueryBase\$where
$where
Definition: ApiQueryBase.php:35
ApiQueryAllDeletedRevisions\run
run(ApiPageSet $resultPageSet=null)
Definition: ApiQueryAllDeletedRevisions.php:45
ApiBase\getModulePrefix
getModulePrefix()
Get parameter prefix (usually two letters or an empty string).
Definition: ApiBase.php:520
key
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message key
Definition: hooks.txt:2154
ApiResult\setIndexedTagName
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:616
ApiBase\dieContinueUsageIf
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
Definition: ApiBase.php:2176
ApiQueryRevisionsBase\extractRevisionInfo
extractRevisionInfo(RevisionRecord $revision, $row)
Extract information from the RevisionRecord.
Definition: ApiQueryRevisionsBase.php:228
ApiQueryBase\addJoinConds
addJoinConds( $join_conds)
Add a set of JOIN conditions to the internal array.
Definition: ApiQueryBase.php:179
$ret
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 & $ret
Definition: hooks.txt:1985
ApiQueryBase\addWhereFld
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
Definition: ApiQueryBase.php:258
ApiBase\PARAM_HELP_MSG_INFO
const PARAM_HELP_MSG_INFO
(array) Specify additional information tags for the parameter.
Definition: ApiBase.php:141
Title\newFromLinkTarget
static newFromLinkTarget(LinkTarget $linkTarget, $forceClone='')
Returns a Title given a LinkTarget.
Definition: Title.php:269
ApiQueryAllDeletedRevisions\__construct
__construct(ApiQuery $query, $moduleName)
Definition: ApiQueryAllDeletedRevisions.php:37
ApiBase\PARAM_DFLT
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
Definition: ApiBase.php:48
$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:1769
ApiBase\getParameter
getParameter( $paramName, $parseLimit=true)
Get a value for the given parameter.
Definition: ApiBase.php:858
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:512
MediaWiki\Storage\NameTableAccessException
Exception representing a failure to look up a row from a name table.
Definition: NameTableAccessException.php:32
ApiBase\PARAM_ISMULTI
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Definition: ApiBase.php:51
ApiQueryBase\addWhere
addWhere( $value)
Add a set of WHERE clauses to the internal array.
Definition: ApiQueryBase.php:225
MediaWikiServices
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 MediaWikiServices
Definition: injection.txt:23
ApiQueryBase\titlePartToKey
titlePartToKey( $titlePart, $namespace=NS_MAIN)
Convert an input title or title prefix into a dbkey.
Definition: ApiQueryBase.php:573
ApiQueryAllDeletedRevisions
Query module to enumerate all deleted revisions.
Definition: ApiQueryAllDeletedRevisions.php:35
ApiQueryBase\addTitleInfo
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
Definition: ApiQueryBase.php:510