Go to the documentation of this file.
35 parent::__construct(
$query, $moduleName,
'dr' );
41 if ( !
$user->isAllowed(
'deletedhistory' ) ) {
43 'You don\'t have permission to view deleted revision information',
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'] );
70 if ( !
$user->isAllowed(
'undelete' ) ) {
76 $titles = $pageSet->getTitles();
85 } elseif ( !is_null(
$params[
'user'] ) ) {
89 if ( $mode ==
'revs' || $mode ==
'user' ) {
91 foreach (
array(
'from',
'to',
'prefix', )
as $p ) {
92 if ( !is_null(
$params[$p] ) ) {
93 $this->
dieUsage(
"The '{$p}' parameter cannot be used in modes 1 or 2",
'badparams' );
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' );
104 if ( !is_null(
$params[
'user'] ) && !is_null(
$params[
'excludeuser'] ) ) {
105 $this->
dieUsage(
'user and excludeuser cannot be used together',
'badparams' );
109 $this->
addFields(
array(
'ar_title',
'ar_namespace',
'ar_timestamp',
'ar_deleted',
'ar_id' ) );
111 $this->
addFieldsIf(
'ar_parent_id', $fld_parentid );
115 $this->
addFieldsIf(
'ar_comment', $fld_comment || $fld_parsedcomment );
123 array(
'tag_summary' =>
array(
'LEFT JOIN',
array(
'ar_rev_id=ts_rev_id' ) ) )
128 if ( !is_null(
$params[
'tag'] ) ) {
131 array(
'change_tag' =>
array(
'INNER JOIN',
array(
'ar_rev_id=ct_rev_id' ) ) )
136 if ( $fld_content ) {
141 $this->
addFields(
array(
'ar_text',
'ar_text_id',
'old_text',
'old_flags' ) );
144 if ( !
$user->isAllowedAny(
'undelete',
'deletedtext' ) ) {
146 'You don\'t have permission to view deleted revision content',
158 $limit = $this->
getMain()->canApiHighLimits() ? $botMax : $userMax;
172 if ( $mode ==
'revs' ) {
176 } elseif ( $mode ==
'all' ) {
187 if ( isset(
$params[
'prefix'] ) ) {
188 $this->
addWhere(
'ar_title' . $db->buildLike(
190 $db->anyString() ) );
194 if ( !is_null(
$params[
'user'] ) ) {
196 } elseif ( !is_null(
$params[
'excludeuser'] ) ) {
197 $this->
addWhere(
'ar_user_text != ' .
198 $db->addQuotes(
$params[
'excludeuser'] ) );
201 if ( !is_null(
$params[
'user'] ) || !is_null(
$params[
'excludeuser'] ) ) {
205 if ( !
$user->isAllowed(
'deletedhistory' ) ) {
207 } elseif ( !
$user->isAllowed(
'suppressrevision' ) ) {
213 $this->
addWhere( $db->bitAnd(
'ar_deleted', $bitmask ) .
" != $bitmask" );
217 if ( !is_null(
$params[
'continue'] ) ) {
218 $cont = explode(
'|',
$params[
'continue'] );
219 $op = (
$dir ==
'newer' ?
'>' :
'<' );
220 if ( $mode ==
'all' || $mode ==
'revs' ) {
222 $ns = intval( $cont[0] );
224 $title = $db->addQuotes( $cont[1] );
225 $ts = $db->addQuotes( $db->timestamp( $cont[2] ) );
226 $ar_id = (int)$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)))))" );
237 $ts = $db->addQuotes( $db->timestamp( $cont[0] ) );
238 $ar_id = (int)$cont[1];
240 $this->
addWhere(
"ar_timestamp $op $ts OR " .
241 "(ar_timestamp = $ts AND " .
242 "ar_id $op= $ar_id)" );
249 array(
'archive' => ( $mode ==
'user' ?
'usertext_timestamp' :
'name_title_timestamp' ) )
251 if ( $mode ==
'all' ) {
254 $this->
addOption(
'GROUP BY',
'ar_title' );
256 $sort = (
$dir ==
'newer' ?
'' :
' DESC' );
259 'ar_timestamp' .
$sort,
264 if ( $mode ==
'revs' ) {
277 foreach (
$res as $row ) {
280 if ( $mode ==
'all' || $mode ==
'revs' ) {
282 "$row->ar_namespace|$row->ar_title|$row->ar_timestamp|$row->ar_id"
295 $rev[
'revid'] = intval( $row->ar_rev_id );
297 if ( $fld_parentid && !is_null( $row->ar_parent_id ) ) {
298 $rev[
'parentid'] = intval( $row->ar_parent_id );
300 if ( $fld_user || $fld_userid ) {
302 $rev[
'userhidden'] =
'';
307 $rev[
'user'] = $row->ar_user_text;
310 $rev[
'userid'] = $row->ar_user;
315 if ( $fld_comment || $fld_parsedcomment ) {
317 $rev[
'commenthidden'] =
'';
321 if ( $fld_comment ) {
322 $rev[
'comment'] = $row->ar_comment;
324 if ( $fld_parsedcomment ) {
331 if ( $fld_minor && $row->ar_minor_edit == 1 ) {
335 $rev[
'len'] = $row->ar_len;
339 $rev[
'sha1hidden'] =
'';
343 if ( $row->ar_sha1 !=
'' ) {
350 if ( $fld_content ) {
352 $rev[
'texthidden'] =
'';
361 if ( $row->ts_tags ) {
362 $tags = explode(
',', $row->ts_tags );
363 $this->
getResult()->setIndexedTagName( $tags,
'tag' );
364 $rev[
'tags'] = $tags;
371 $rev[
'suppressed'] =
'';
374 if ( !isset( $pageMap[$row->ar_namespace][$row->ar_title] ) ) {
375 $pageID = $newPageID++;
376 $pageMap[$row->ar_namespace][$row->ar_title] = $pageID;
378 $result->setIndexedTagName( $a[
'revisions'],
'rev' );
382 $a[
'token'] = $token;
386 $pageID = $pageMap[$row->ar_namespace][$row->ar_title];
392 if ( $mode ==
'all' || $mode ==
'revs' ) {
394 "$row->ar_namespace|$row->ar_title|$row->ar_timestamp|$row->ar_id"
429 'excludeuser' =>
array(
432 'namespace' =>
array(
466 'start' =>
'The timestamp to start enumerating from (1, 2)',
467 'end' =>
'The timestamp to stop enumerating at (1, 2)',
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',
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',
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',
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.',
525 return array_merge( parent::getPossibleErrors(),
array(
527 'code' =>
'permissiondenied',
528 'info' =>
'You don\'t have permission to view deleted revision information'
530 array(
'code' =>
'badparams',
'info' =>
'user and excludeuser cannot be used together'
533 'code' =>
'permissiondenied',
534 'info' =>
'You don\'t have permission to view deleted revision content'
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" ),
539 'code' =>
'badparams',
540 'info' =>
"The 'prefix' parameter cannot be used in modes 1 or 2"
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" ),
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):',
562 return 'https://www.mediawiki.org/wiki/API:Deletedrevs';
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
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
addFields( $value)
Add a set of fields to select to the internal array.
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
Class representing a list of titles The execute() method checks them all for existence and adds them ...
static setContent(&$arr, $value, $subElemName=null)
Adds a content element to an array.
addTimestampWhereRange( $field, $dir, $start, $end, $sort=true)
Add a WHERE clause corresponding to a range, similar to addWhereRange, but converts $start and $end t...
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
getResult()
Get the result object.
select( $method, $extraQuery=array())
Execute a SELECT query based on the values in the internal arrays.
getDirectionDescription( $p='', $extraDirText='')
Gets the personalised direction parameter description.
static getRevisionText( $row, $prefix='old_', $wiki=false)
Get revision text associated with an old or archive row $row is usually an object from wfFetchRow(),...
getRequest()
Get the WebRequest object.
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision,...
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
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...
getUser()
Get the User object.
addFieldsIf( $value, $condition)
Same as addFields(), but add the fields only if a condition is met.
if( $wgAPIRequestLog) $lb
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
This is a base class for all Query modules.
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
getDB()
Get the Query database connection (read-only)
getExamples()
Returns usage examples for this module.
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
getModulePrefix()
Get parameter prefix (usually two letters or an empty string).
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.
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
presenting them properly to the user as errors is done by the caller $title
dieContinueUsageIf( $condition)
Die with the $prefix.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
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...
addJoinConds( $join_conds)
Add a set of JOIN conditions to the internal array.
titlePartToKey( $titlePart, $defaultNamespace=NS_MAIN)
An alternative to titleToKey() that doesn't trim trailing spaces, and does not mangle the input if st...
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
getPageSet()
Get the PageSet object to work on.
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
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
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
if(count( $args)==0) $dir
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...
validateLimit( $paramName, &$value, $min, $max, $botMax=null, $enforceLimits=false)
Validate the value against the minimum and user/bot maximum limits.
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
getModuleName()
Get the name of the module being executed by this instance.
getParamDescription()
Returns an array of parameter descriptions.
getMain()
Get the main module.
addWhere( $value)
Add a set of WHERE clauses to the internal array.
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
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
getDescription()
Returns the description string for this module.
Query module to enumerate all deleted revisions.
getResultProperties()
Returns possible properties in the result, grouped by the value of the prop parameter that shows them...
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
__construct( $query, $moduleName)