34 parent::__construct(
$query, $moduleName,
'drv' );
43 $pageMap = $pageSet->getGoodAndMissingTitlesByNamespace();
44 $pageCount = count( $pageSet->getGoodAndMissingTitles() );
45 $revCount = $pageSet->getRevisionCount();
46 if ( $revCount === 0 && $pageCount === 0 ) {
50 if ( $revCount !== 0 && count( $pageSet->getDeletedRevisionIDs() ) === 0 ) {
61 if ( $resultPageSet ===
null ) {
63 $arQuery = Revision::getArchiveQueryInfo();
67 $this->
addFields( [
'ar_title',
'ar_namespace' ] );
71 $this->
addFields( [
'ar_title',
'ar_namespace',
'ar_timestamp',
'ar_rev_id',
'ar_id' ] );
74 if ( $this->fld_tags ) {
77 [
'tag_summary' => [
'LEFT JOIN', [
'ar_rev_id=ts_rev_id' ] ] ]
82 if ( !is_null(
$params[
'tag'] ) ) {
85 [
'change_tag' => [
'INNER JOIN', [
'ar_rev_id=ct_rev_id' ] ] ]
90 if ( $this->fetchContent ) {
93 [
'text' => [
'LEFT JOIN', [
'ar_text_id=old_id' ] ] ]
95 $this->
addFields( [
'old_text',
'old_flags' ] );
103 if ( $revCount !== 0 ) {
105 'ar_rev_id' => array_keys( $pageSet->getDeletedRevisionIDs() )
109 $lb =
new LinkBatch( $pageSet->getGoodAndMissingTitles() );
110 $where = $lb->constructSet(
'ar', $db );
114 if ( !is_null(
$params[
'user'] ) ) {
116 $actorQuery = ActorMigration::newMigration()
118 $this->
addTables( $actorQuery[
'tables'] );
120 $this->
addWhere( $actorQuery[
'conds'] );
121 } elseif ( !is_null(
$params[
'excludeuser'] ) ) {
123 $actorQuery = ActorMigration::newMigration()
125 $this->
addTables( $actorQuery[
'tables'] );
127 $this->
addWhere(
'NOT(' . $actorQuery[
'conds'] .
')' );
130 if ( !is_null(
$params[
'user'] ) || !is_null(
$params[
'excludeuser'] ) ) {
134 if ( !
$user->isAllowed(
'deletedhistory' ) ) {
135 $bitmask = Revision::DELETED_USER;
136 } elseif ( !
$user->isAllowedAny(
'suppressrevision',
'viewsuppressed' ) ) {
137 $bitmask = Revision::DELETED_USER | Revision::DELETED_RESTRICTED;
142 $this->
addWhere( $db->bitAnd(
'ar_deleted', $bitmask ) .
" != $bitmask" );
146 if ( !is_null(
$params[
'continue'] ) ) {
147 $cont = explode(
'|',
$params[
'continue'] );
148 $op = ( $dir ==
'newer' ?
'>' :
'<' );
149 if ( $revCount !== 0 ) {
151 $rev = intval( $cont[0] );
153 $ar_id = (int)$cont[1];
155 $this->
addWhere(
"ar_rev_id $op $rev OR " .
156 "(ar_rev_id = $rev AND " .
157 "ar_id $op= $ar_id)" );
160 $ns = intval( $cont[0] );
162 $title = $db->addQuotes( $cont[1] );
163 $ts = $db->addQuotes( $db->timestamp( $cont[2] ) );
164 $ar_id = (int)$cont[3];
166 $this->
addWhere(
"ar_namespace $op $ns OR " .
167 "(ar_namespace = $ns AND " .
168 "(ar_title $op $title OR " .
169 "(ar_title = $title AND " .
170 "(ar_timestamp $op $ts OR " .
171 "(ar_timestamp = $ts AND " .
172 "ar_id $op= $ar_id)))))" );
176 $this->
addOption(
'LIMIT', $this->limit + 1 );
178 if ( $revCount !== 0 ) {
184 if ( count( $pageMap ) > 1 ) {
187 $oneTitle =
key( reset( $pageMap ) );
188 foreach ( $pageMap
as $pages ) {
189 if ( count( $pages ) > 1 ||
key( $pages ) !== $oneTitle ) {
202 foreach (
$res as $row ) {
203 if ( ++$count > $this->limit ) {
207 ?
"$row->ar_rev_id|$row->ar_id"
208 :
"$row->ar_namespace|$row->ar_title|$row->ar_timestamp|$row->ar_id"
213 if ( $resultPageSet !==
null ) {
214 $generated[] = $row->ar_rev_id;
216 if ( !isset( $pageMap[$row->ar_namespace][$row->ar_title] ) ) {
218 $title = Title::makeTitle( $row->ar_namespace, $row->ar_title );
219 $converted = $pageSet->getConvertedTitles();
220 if (
$title && isset( $converted[
$title->getPrefixedText()] ) ) {
221 $title = Title::newFromText( $converted[
$title->getPrefixedText()] );
223 $pageMap[$row->ar_namespace][$row->ar_title] =
228 if ( !isset( $pageMap[$row->ar_namespace][$row->ar_title] ) ) {
231 "Found row in archive (ar_id={$row->ar_id}) that didn't get processed by ApiPageSet"
236 $pageMap[$row->ar_namespace][$row->ar_title],
237 $this->extractRevisionInfo( Revision::newFromArchiveRow( $row ), $row ),
243 ?
"$row->ar_rev_id|$row->ar_id"
244 :
"$row->ar_namespace|$row->ar_title|$row->ar_timestamp|$row->ar_id"
251 if ( $resultPageSet !==
null ) {
252 $resultPageSet->populateFromRevisionIDs( $generated );
257 return parent::getAllowedParams() + [
287 'action=query&prop=deletedrevisions&titles=Main%20Page|Talk:Main%20Page&' .
288 'drvprop=user|comment|content'
289 =>
'apihelp-query+deletedrevisions-example-titles',
290 'action=query&prop=deletedrevisions&revids=123456'
291 =>
'apihelp-query+deletedrevisions-example-revids',
296 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.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
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
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
namespace and then decline to actually register it file or subcat img or subcat $title
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
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 local account $user
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