MediaWiki REL1_28
Go to the documentation of this file.
28 public $mForm;
31 public $mConds;
33 function __construct( SpecialMergeHistory $form, $conds, Title $source, Title $dest ) {
34 $this->mForm = $form;
35 $this->mConds = $conds;
36 $this->title = $source;
37 $this->articleID = $source->getArticleID();
40 $maxtimestamp = $dbr->selectField(
41 'revision',
42 'MIN(rev_timestamp)',
43 [ 'rev_page' => $dest->getArticleID() ],
44 __METHOD__
45 );
46 $this->maxTimestamp = $maxtimestamp;
48 parent::__construct( $form->getContext() );
49 }
51 function getStartBody() {
52 # Do a link batch query
53 $this->mResult->seek( 0 );
54 $batch = new LinkBatch();
55 # Give some pointers to make (last) links
56 $this->mForm->prevId = [];
57 foreach ( $this->mResult as $row ) {
58 $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
59 $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
61 $rev_id = isset( $rev_id ) ? $rev_id : $row->rev_id;
62 if ( $rev_id > $row->rev_id ) {
63 $this->mForm->prevId[$rev_id] = $row->rev_id;
64 } elseif ( $rev_id < $row->rev_id ) {
65 $this->mForm->prevId[$row->rev_id] = $rev_id;
66 }
68 $rev_id = $row->rev_id;
69 }
71 $batch->execute();
72 $this->mResult->seek( 0 );
74 return '';
75 }
77 function formatRow( $row ) {
78 return $this->mForm->formatRevisionRow( $row );
79 }
81 function getQueryInfo() {
82 $conds = $this->mConds;
83 $conds['rev_page'] = $this->articleID;
84 $conds[] = "rev_timestamp < " . $this->mDb->addQuotes( $this->maxTimestamp );
86 return [
87 'tables' => [ 'revision', 'page', 'user' ],
88 'fields' => array_merge( Revision::selectFields(), Revision::selectUserFields() ),
89 'conds' => $conds,
90 'join_conds' => [
91 'page' => Revision::pageJoinCond(),
92 'user' => Revision::userJoinCond() ]
93 ];
94 }
96 function getIndexField() {
97 return 'rev_timestamp';
98 }
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition LinkBatch.php:32
SpecialMergeHistory $mForm
Hook into getBody(), allows text to be inserted at the start.
formatRow( $row)
Abstract formatting function.
This function should be overridden to provide all parameters needed for the main paged query.
__construct(SpecialMergeHistory $form, $conds, Title $source, Title $dest)
This function should be overridden to return the name of the index fi- eld.
IndexPager with a formatted navigation bar.
static userJoinCond()
Return the value of a select() JOIN conds array for the user table.
Definition Revision.php:423
static selectFields()
Return the list of revision fields that should be selected to create a new revision.
Definition Revision.php:442
static selectUserFields()
Return the list of user fields that should be selected from user table.
Definition Revision.php:530
static pageJoinCond()
Return the value of a select() page conds array for the page table.
Definition Revision.php:433
Special page allowing users with the appropriate permissions to merge article histories,...
Gets the context this SpecialPage is executed in.
Represents a title within MediaWiki.
Definition Title.php:36
getArticleID( $flags=0)
Get the article ID for this Title from the link cache, adding it if necessary.
Definition Title.php:3209
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
const NS_USER
Definition Defines.php:58
Definition Defines.php:59
the array() calling protocol came about after MediaWiki 1.4rc1.
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:37
Definition linkcache.txt:23
Definition defines.php:22