36 parent::__construct(
$query, $moduleName,
'drv' );
45 $pageMap = $pageSet->getGoodAndMissingTitlesByNamespace();
46 $pageCount = count( $pageSet->getGoodAndMissingTitles() );
47 $revCount = $pageSet->getRevisionCount();
48 if ( $revCount === 0 && $pageCount === 0 ) {
52 if ( $revCount !== 0 && count( $pageSet->getDeletedRevisionIDs() ) === 0 ) {
64 if ( $resultPageSet ===
null ) {
67 $this->
addFields( [
'ar_title',
'ar_namespace' ] );
70 $this->
addFields( [
'ar_title',
'ar_namespace',
'ar_timestamp',
'ar_rev_id',
'ar_id' ] );
73 if ( $this->fld_tags ) {
76 [
'tag_summary' => [
'LEFT JOIN', [
'ar_rev_id=ts_rev_id' ] ] ]
81 if ( !is_null(
$params[
'tag'] ) ) {
84 [
'change_tag' => [
'INNER JOIN', [
'ar_rev_id=ct_rev_id' ] ] ]
89 if ( $this->fetchContent ) {
97 [
'text' => [
'LEFT JOIN', [
'ar_text_id=old_id' ] ] ]
99 $this->
addFields( [
'ar_text',
'ar_flags',
'old_text',
'old_flags' ] );
107 if ( $revCount !== 0 ) {
109 'ar_rev_id' => array_keys( $pageSet->getDeletedRevisionIDs() )
113 $lb =
new LinkBatch( $pageSet->getGoodAndMissingTitles() );
114 $where = $lb->constructSet(
'ar', $db );
118 if ( !is_null(
$params[
'user'] ) ) {
120 } elseif ( !is_null(
$params[
'excludeuser'] ) ) {
121 $this->
addWhere(
'ar_user_text != ' .
122 $db->addQuotes(
$params[
'excludeuser'] ) );
125 if ( !is_null(
$params[
'user'] ) || !is_null(
$params[
'excludeuser'] ) ) {
129 if ( !$user->isAllowed(
'deletedhistory' ) ) {
131 } elseif ( !$user->isAllowedAny(
'suppressrevision',
'viewsuppressed' ) ) {
137 $this->
addWhere( $db->bitAnd(
'ar_deleted', $bitmask ) .
" != $bitmask" );
141 if ( !is_null(
$params[
'continue'] ) ) {
142 $cont = explode(
'|',
$params[
'continue'] );
143 $op = (
$dir ==
'newer' ?
'>' :
'<' );
144 if ( $revCount !== 0 ) {
146 $rev = intval( $cont[0] );
148 $ar_id = (int)$cont[1];
150 $this->
addWhere(
"ar_rev_id $op $rev OR " .
151 "(ar_rev_id = $rev AND " .
152 "ar_id $op= $ar_id)" );
155 $ns = intval( $cont[0] );
157 $title = $db->addQuotes( $cont[1] );
158 $ts = $db->addQuotes( $db->timestamp( $cont[2] ) );
159 $ar_id = (int)$cont[3];
161 $this->
addWhere(
"ar_namespace $op $ns OR " .
162 "(ar_namespace = $ns AND " .
163 "(ar_title $op $title OR " .
164 "(ar_title = $title AND " .
165 "(ar_timestamp $op $ts OR " .
166 "(ar_timestamp = $ts AND " .
167 "ar_id $op= $ar_id)))))" );
171 $this->
addOption(
'LIMIT', $this->limit + 1 );
173 if ( $revCount !== 0 ) {
179 if ( count( $pageMap ) > 1 ) {
182 $oneTitle =
key( reset( $pageMap ) );
183 foreach ( $pageMap as $pages ) {
184 if ( count( $pages ) > 1 ||
key( $pages ) !== $oneTitle ) {
197 foreach (
$res as $row ) {
198 if ( ++$count > $this->limit ) {
202 ?
"$row->ar_rev_id|$row->ar_id"
203 :
"$row->ar_namespace|$row->ar_title|$row->ar_timestamp|$row->ar_id"
208 if ( $resultPageSet !==
null ) {
209 $generated[] = $row->ar_rev_id;
211 if ( !isset( $pageMap[$row->ar_namespace][$row->ar_title] ) ) {
213 $title = Title::makeTitle( $row->ar_namespace, $row->ar_title );
214 $converted = $pageSet->getConvertedTitles();
215 if ( $title && isset( $converted[$title->getPrefixedText()] ) ) {
216 $title = Title::newFromText( $converted[$title->getPrefixedText()] );
217 if ( $title && isset( $pageMap[$title->getNamespace()][$title->getDBkey()] ) ) {
218 $pageMap[$row->ar_namespace][$row->ar_title] =
219 $pageMap[$title->getNamespace()][$title->getDBkey()];
223 if ( !isset( $pageMap[$row->ar_namespace][$row->ar_title] ) ) {
226 "Found row in archive (ar_id={$row->ar_id}) that didn't get processed by ApiPageSet"
231 $pageMap[$row->ar_namespace][$row->ar_title],
238 ?
"$row->ar_rev_id|$row->ar_id"
239 :
"$row->ar_namespace|$row->ar_title|$row->ar_timestamp|$row->ar_id"
246 if ( $resultPageSet !==
null ) {
247 $resultPageSet->populateFromRevisionIDs( $generated );
252 return parent::getAllowedParams() + [
282 'action=query&prop=deletedrevisions&titles=Main%20Page|Talk:Main%20Page&' .
283 'drvprop=user|comment|content'
284 =>
'apihelp-query+deletedrevisions-example-titles',
285 'action=query&prop=deletedrevisions&revids=123456'
286 =>
'apihelp-query+deletedrevisions-example-revids',
291 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Deletedrevisions';
checkUserRightsAny( $rights, $user=null)
Helper function for permission-denied errors.
getParameter( $paramName, $parseLimit=true)
Get a value for the given parameter.
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
requireMaxOneParameter( $params, $required)
Die if more than one of a certain set of parameters is set and not false.
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
This class contains a list of pages that the client has requested.
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.
addFields( $value)
Add a set of fields to select to the internal array.
addPageSubItem( $pageId, $item, $elemname=null)
Same as addPageSubItems(), but one element of $data at a time.
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
addTables( $tables, $alias=null)
Add a set of tables to the internal 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...
getDB()
Get the Query database connection (read-only)
addJoinConds( $join_conds)
Add a set of JOIN conditions to the internal array.
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
addWhere( $value)
Add a set of WHERE clauses to the internal array.
Query module to enumerate deleted revisions for pages.
__construct(ApiQuery $query, $moduleName)
getExamplesMessages()
Returns usage examples for this module.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getHelpUrls()
Return links to more detailed help pages about the module.
run(ApiPageSet $resultPageSet=null)
setContinueEnumParameter( $paramName, $paramValue)
Overridden to set the generator param if in generator mode.
getPageSet()
Get the PageSet object to work on.
A base class for functions common to producing a list of revisions.
parseParameters( $params)
Parse the parameters into the various instance fields.
This is the main query class.
getUser()
Get the User object.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
static selectArchiveFields()
Return the list of revision fields that should be selected to create a new revision from an archive r...
static newFromArchiveRow( $row, $overrides=[])
Make a fake revision object from an archive table row.
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like select() and insert() are usually more convenient. They take care of things like table prefixes and escaping for you. If you really need to make your own SQL
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database key
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
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