Go to the documentation of this file.
38 parent::__construct(
$query, $moduleName,
'drv' );
49 $pageMap = $pageSet->getGoodAndMissingTitlesByNamespace();
50 $pageCount =
count( $pageSet->getGoodAndMissingTitles() );
51 $revCount = $pageSet->getRevisionCount();
52 if ( $revCount === 0 && $pageCount === 0 ) {
56 if ( $revCount !== 0 &&
count( $pageSet->getDeletedRevisionIDs() ) === 0 ) {
64 $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
68 if ( $resultPageSet ===
null ) {
70 $arQuery = $revisionStore->getArchiveQueryInfo();
74 $this->
addFields( [
'ar_title',
'ar_namespace' ] );
78 $this->
addFields( [
'ar_title',
'ar_namespace',
'ar_timestamp',
'ar_rev_id',
'ar_id' ] );
81 if ( $this->fld_tags ) {
84 [
'tag_summary' => [
'LEFT JOIN', [
'ar_rev_id=ts_rev_id' ] ] ]
89 if ( !is_null(
$params[
'tag'] ) ) {
92 [
'change_tag' => [
'INNER JOIN', [
'ar_rev_id=ct_rev_id' ] ] ]
95 $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore();
107 if ( $this->fetchContent ) {
110 [
'text' => [
'LEFT JOIN', [
'ar_text_id=old_id' ] ] ]
112 $this->
addFields( [
'old_text',
'old_flags' ] );
120 if ( $revCount !== 0 ) {
122 'ar_rev_id' => array_keys( $pageSet->getDeletedRevisionIDs() )
126 $lb =
new LinkBatch( $pageSet->getGoodAndMissingTitles() );
127 $where = $lb->constructSet(
'ar', $db );
131 if ( !is_null(
$params[
'user'] ) ) {
135 $this->
addTables( $actorQuery[
'tables'] );
137 $this->
addWhere( $actorQuery[
'conds'] );
138 } elseif ( !is_null(
$params[
'excludeuser'] ) ) {
142 $this->
addTables( $actorQuery[
'tables'] );
144 $this->
addWhere(
'NOT(' . $actorQuery[
'conds'] .
')' );
147 if ( !is_null(
$params[
'user'] ) || !is_null(
$params[
'excludeuser'] ) ) {
151 if ( !
$user->isAllowed(
'deletedhistory' ) ) {
152 $bitmask = RevisionRecord::DELETED_USER;
153 } elseif ( !
$user->isAllowedAny(
'suppressrevision',
'viewsuppressed' ) ) {
154 $bitmask = RevisionRecord::DELETED_USER | RevisionRecord::DELETED_RESTRICTED;
159 $this->
addWhere( $db->bitAnd(
'ar_deleted', $bitmask ) .
" != $bitmask" );
163 if ( !is_null(
$params[
'continue'] ) ) {
164 $cont = explode(
'|',
$params[
'continue'] );
165 $op = ( $dir ==
'newer' ?
'>' :
'<' );
166 if ( $revCount !== 0 ) {
168 $rev = intval( $cont[0] );
170 $ar_id = (int)$cont[1];
172 $this->
addWhere(
"ar_rev_id $op $rev OR " .
173 "(ar_rev_id = $rev AND " .
174 "ar_id $op= $ar_id)" );
177 $ns = intval( $cont[0] );
179 $title = $db->addQuotes( $cont[1] );
180 $ts = $db->addQuotes( $db->timestamp( $cont[2] ) );
181 $ar_id = (int)$cont[3];
183 $this->
addWhere(
"ar_namespace $op $ns OR " .
184 "(ar_namespace = $ns AND " .
185 "(ar_title $op $title OR " .
186 "(ar_title = $title AND " .
187 "(ar_timestamp $op $ts OR " .
188 "(ar_timestamp = $ts AND " .
189 "ar_id $op= $ar_id)))))" );
193 $this->
addOption(
'LIMIT', $this->limit + 1 );
195 if ( $revCount !== 0 ) {
201 if (
count( $pageMap ) > 1 ) {
204 $oneTitle =
key( reset( $pageMap ) );
205 foreach ( $pageMap
as $pages ) {
206 if (
count( $pages ) > 1 ||
key( $pages ) !== $oneTitle ) {
219 foreach (
$res as $row ) {
220 if ( ++$count > $this->limit ) {
224 ?
"$row->ar_rev_id|$row->ar_id"
225 :
"$row->ar_namespace|$row->ar_title|$row->ar_timestamp|$row->ar_id"
230 if ( $resultPageSet !==
null ) {
231 $generated[] = $row->ar_rev_id;
233 if ( !isset( $pageMap[$row->ar_namespace][$row->ar_title] ) ) {
236 $converted = $pageSet->getConvertedTitles();
237 if (
$title && isset( $converted[
$title->getPrefixedText()] ) ) {
240 $pageMap[$row->ar_namespace][$row->ar_title] =
245 if ( !isset( $pageMap[$row->ar_namespace][$row->ar_title] ) ) {
248 "Found row in archive (ar_id={$row->ar_id}) that didn't get processed by ApiPageSet"
253 $pageMap[$row->ar_namespace][$row->ar_title],
254 $this->extractRevisionInfo( $revisionStore->newRevisionFromArchiveRow( $row ), $row ),
260 ?
"$row->ar_rev_id|$row->ar_id"
261 :
"$row->ar_namespace|$row->ar_title|$row->ar_timestamp|$row->ar_id"
268 if ( $resultPageSet !==
null ) {
269 $resultPageSet->populateFromRevisionIDs( $generated );
274 return parent::getAllowedParams() + [
304 'action=query&prop=deletedrevisions&titles=Main%20Page|Talk:Main%20Page&' .
305 'drvslots=*&drvprop=user|comment|content'
306 =>
'apihelp-query+deletedrevisions-example-titles',
307 'action=query&prop=deletedrevisions&revids=123456'
308 =>
'apihelp-query+deletedrevisions-example-revids',
313 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Deletedrevisions';
run(ApiPageSet $resultPageSet=null)
parseParameters( $params)
Parse the parameters into the various instance fields.
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
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
addFields( $value)
Add a set of fields to select to the internal array.
This is the main query class.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Query module to enumerate deleted revisions for pages.
addTimestampWhereRange( $field, $dir, $start, $end, $sort=true)
Add a WHERE clause corresponding to a range, similar to addWhereRange, but converts $start and $end t...
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
checkUserRightsAny( $rights, $user=null)
Helper function for permission-denied errors.
const MIGRATION_WRITE_BOTH
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
static newMigration()
Static constructor.
This class contains a list of pages that the client has requested.
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
A base class for functions common to producing a list of revisions.
setContinueEnumParameter( $paramName, $paramValue)
Overridden to set the generator param if in generator mode.
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
getExamplesMessages()
Returns usage examples for this module.
getPageSet()
Get the PageSet object to work on.
namespace and then decline to actually register it file or subcat img or subcat $title
getDB()
Get the Query database connection (read-only)
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
select( $method, $extraQuery=[], array &$hookData=null)
Execute a SELECT query based on the values in the internal arrays.
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
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
getHelpUrls()
Return links to more detailed help pages about the module.
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
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.
int $wgChangeTagsSchemaMigrationStage
change_tag table schema migration stage.
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
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
addJoinConds( $join_conds)
Add a set of JOIN conditions to the internal array.
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
requireMaxOneParameter( $params, $required)
Die if more than one of a certain set of parameters is set and not false.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
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
getParameter( $paramName, $parseLimit=true)
Get a value for the given parameter.
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
__construct(ApiQuery $query, $moduleName)
addWhere( $value)
Add a set of WHERE clauses to the internal array.
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
addPageSubItem( $pageId, $item, $elemname=null)
Same as addPageSubItems(), but one element of $data at a time.
static dieDebug( $method, $message)
Internal code errors should be reported with this method.