MediaWiki REL1_33
MergeHistoryPager.php
Go to the documentation of this file.
1<?php
26
28 public $mForm;
29
31 public $mConds;
32
33 public 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();
38
40 $maxtimestamp = $dbr->selectField(
41 'revision',
42 'MIN(rev_timestamp)',
43 [ 'rev_page' => $dest->getArticleID() ],
44 __METHOD__
45 );
46 $this->maxTimestamp = $maxtimestamp;
47
48 parent::__construct( $form->getContext() );
49 }
50
51 protected 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 $rev_id = null;
58 foreach ( $this->mResult as $row ) {
59 $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
60 $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
61
62 if ( isset( $rev_id ) ) {
63 if ( $rev_id > $row->rev_id ) {
64 $this->mForm->prevId[$rev_id] = $row->rev_id;
65 } elseif ( $rev_id < $row->rev_id ) {
66 $this->mForm->prevId[$row->rev_id] = $rev_id;
67 }
68 }
69
70 $rev_id = $row->rev_id;
71 }
72
73 $batch->execute();
74 $this->mResult->seek( 0 );
75
76 return '';
77 }
78
79 function formatRow( $row ) {
80 return $this->mForm->formatRevisionRow( $row );
81 }
82
83 function getQueryInfo() {
84 $conds = $this->mConds;
85 $conds['rev_page'] = $this->articleID;
86 $conds[] = "rev_timestamp < " . $this->mDb->addQuotes( $this->maxTimestamp );
87
88 $revQuery = Revision::getQueryInfo( [ 'page', 'user' ] );
89 return [
90 'tables' => $revQuery['tables'],
91 'fields' => $revQuery['fields'],
92 'conds' => $conds,
93 'join_conds' => $revQuery['joins']
94 ];
95 }
96
97 function getIndexField() {
98 return 'rev_timestamp';
99 }
100}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
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:34
SpecialMergeHistory $mForm
getStartBody()
Hook into getBody(), allows text to be inserted at the start.
formatRow( $row)
Abstract formatting function.
getQueryInfo()
This function should be overridden to provide all parameters needed for the main paged query.
__construct(SpecialMergeHistory $form, $conds, Title $source, Title $dest)
getIndexField()
This function should be overridden to return the name of the index fi- eld.
Efficient paging for SQL queries.
static getQueryInfo( $options=[])
Return the tables, fields, and join conditions to be selected to create a new revision object.
Definition Revision.php:511
Special page allowing users with the appropriate permissions to merge article histories,...
Represents a title within MediaWiki.
Definition Title.php:40
getArticleID( $flags=0)
Get the article ID for this Title from the link cache, adding it if necessary.
Definition Title.php:2954
const NS_USER_TALK
Definition Defines.php:76
$batch
Definition linkcache.txt:23
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
$source
const DB_REPLICA
Definition defines.php:25
title