MediaWiki
REL1_34
MergeHistoryPager.php
Go to the documentation of this file.
1
<?php
25
class
MergeHistoryPager
extends
ReverseChronologicalPager
{
26
28
public
$mForm
;
29
31
public
$mConds
;
32
34
private
$articleID
;
35
37
private
$maxTimestamp
;
38
39
public
function
__construct
(
SpecialMergeHistory
$form, $conds,
Title
$source
,
Title
$dest ) {
40
$this->mForm = $form;
41
$this->mConds = $conds;
42
$this->articleID =
$source
->getArticleID();
43
44
$dbr
=
wfGetDB
(
DB_REPLICA
);
45
$maxtimestamp =
$dbr
->selectField(
46
'revision'
,
47
'MIN(rev_timestamp)'
,
48
[
'rev_page'
=> $dest->
getArticleID
() ],
49
__METHOD__
50
);
51
$this->maxTimestamp = $maxtimestamp;
52
53
parent::__construct( $form->
getContext
() );
54
}
55
56
protected
function
getStartBody
() {
57
# Do a link batch query
58
$this->mResult->seek( 0 );
59
$batch =
new
LinkBatch
();
60
# Give some pointers to make (last) links
61
$this->mForm->prevId = [];
62
$rev_id =
null
;
63
foreach
( $this->mResult as $row ) {
64
$batch->addObj( Title::makeTitleSafe(
NS_USER
, $row->user_name ) );
65
$batch->addObj( Title::makeTitleSafe(
NS_USER_TALK
, $row->user_name ) );
66
67
if
( isset( $rev_id ) ) {
68
if
( $rev_id > $row->rev_id ) {
69
$this->mForm->prevId[$rev_id] = $row->rev_id;
70
} elseif ( $rev_id < $row->rev_id ) {
71
$this->mForm->prevId[$row->rev_id] = $rev_id;
72
}
73
}
74
75
$rev_id = $row->rev_id;
76
}
77
78
$batch->execute();
79
$this->mResult->seek( 0 );
80
81
return
''
;
82
}
83
84
function
formatRow
( $row ) {
85
return
$this->mForm->formatRevisionRow( $row );
86
}
87
88
function
getQueryInfo
() {
89
$conds =
$this->mConds
;
90
$conds[
'rev_page'
] =
$this->articleID
;
91
$conds[] =
"rev_timestamp < "
. $this->mDb->addQuotes( $this->maxTimestamp );
92
93
$revQuery
=
Revision::getQueryInfo
( [
'page'
,
'user'
] );
94
return
[
95
'tables'
=>
$revQuery
[
'tables'
],
96
'fields'
=>
$revQuery
[
'fields'
],
97
'conds'
=> $conds,
98
'join_conds'
=>
$revQuery
[
'joins'
]
99
];
100
}
101
102
function
getIndexField
() {
103
return
'rev_timestamp'
;
104
}
105
}
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition
GlobalFunctions.php:2555
LinkBatch
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition
LinkBatch.php:34
MergeHistoryPager
Definition
MergeHistoryPager.php:25
MergeHistoryPager\$mForm
SpecialMergeHistory $mForm
Definition
MergeHistoryPager.php:28
MergeHistoryPager\getStartBody
getStartBody()
Hook into getBody(), allows text to be inserted at the start.
Definition
MergeHistoryPager.php:56
MergeHistoryPager\formatRow
formatRow( $row)
Abstract formatting function.
Definition
MergeHistoryPager.php:84
MergeHistoryPager\getQueryInfo
getQueryInfo()
This function should be overridden to provide all parameters needed for the main paged query.
Definition
MergeHistoryPager.php:88
MergeHistoryPager\$articleID
int $articleID
Definition
MergeHistoryPager.php:34
MergeHistoryPager\__construct
__construct(SpecialMergeHistory $form, $conds, Title $source, Title $dest)
Definition
MergeHistoryPager.php:39
MergeHistoryPager\$mConds
array $mConds
Definition
MergeHistoryPager.php:31
MergeHistoryPager\$maxTimestamp
int $maxTimestamp
Definition
MergeHistoryPager.php:37
MergeHistoryPager\getIndexField
getIndexField()
This function should be overridden to return the name of the index fi- eld.
Definition
MergeHistoryPager.php:102
ReverseChronologicalPager
Efficient paging for SQL queries.
Definition
ReverseChronologicalPager.php:28
Revision\getQueryInfo
static getQueryInfo( $options=[])
Return the tables, fields, and join conditions to be selected to create a new revision object.
Definition
Revision.php:315
SpecialMergeHistory
Special page allowing users with the appropriate permissions to merge article histories,...
Definition
SpecialMergeHistory.php:32
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition
SpecialPage.php:692
Title
Represents a title within MediaWiki.
Definition
Title.php:42
Title\getArticleID
getArticleID( $flags=0)
Get the article ID for this Title from the link cache, adding it if necessary.
Definition
Title.php:3126
NS_USER
const NS_USER
Definition
Defines.php:71
NS_USER_TALK
const NS_USER_TALK
Definition
Defines.php:72
$source
$source
Definition
mwdoc-filter.php:34
DB_REPLICA
const DB_REPLICA
Definition
defines.php:25
$dbr
$dbr
Definition
testCompression.php:50
$revQuery
$revQuery
Definition
testCompression.php:51
includes
specials
pagers
MergeHistoryPager.php
Generated on Fri Apr 5 2024 23:10:35 for MediaWiki by
1.9.8