MediaWiki
REL1_40
RevDelArchiveItem.php
Go to the documentation of this file.
1
<?php
22
use
MediaWiki\MediaWikiServices
;
23
use
MediaWiki\Revision\RevisionFactory
;
24
28
class
RevDelArchiveItem
extends
RevDelRevisionItem
{
29
protected
static
function
initRevisionRecord
(
$list
,
$row
) {
30
$revRecord = MediaWikiServices::getInstance()
31
->getRevisionFactory()
32
->newRevisionFromArchiveRow(
33
$row
,
34
RevisionFactory::READ_NORMAL,
35
null
,
36
[
'page_id'
=>
$list
->
getPage
()->getId() ]
37
);
38
39
return
$revRecord;
40
}
41
42
public
function
getIdField
() {
43
return
'ar_timestamp'
;
44
}
45
46
public
function
getTimestampField
() {
47
return
'ar_timestamp'
;
48
}
49
50
public
function
getAuthorIdField
() {
51
return
'ar_user'
;
52
}
53
54
public
function
getAuthorNameField
() {
55
return
'ar_user_text'
;
56
}
57
58
public
function
getAuthorActorField
() {
59
return
'ar_actor'
;
60
}
61
62
public
function
getId
() {
63
# Convert DB timestamp to MW timestamp
64
return
$this->revisionRecord->getTimestamp();
65
}
66
67
public
function
setBits
( $bits ) {
68
$dbw =
wfGetDB
(
DB_PRIMARY
);
69
$dbw->update(
'archive'
,
70
[
'ar_deleted'
=> $bits ],
71
[
72
'ar_namespace'
=> $this->list->getPage()->getNamespace(),
73
'ar_title'
=> $this->list->getPage()->getDBkey(),
74
// use timestamp for index
75
'ar_timestamp'
=> $this->row->ar_timestamp,
76
'ar_rev_id'
=> $this->row->ar_rev_id,
77
'ar_deleted'
=> $this->getBits()
78
],
79
__METHOD__ );
80
81
return
(
bool
)$dbw->affectedRows();
82
}
83
84
protected
function
getRevisionLink
() {
85
$date = $this->list->getLanguage()->userTimeAndDate(
86
$this->revisionRecord->getTimestamp(), $this->list->getUser() );
87
88
if
( $this->
isDeleted
() && !$this->
canViewContent
() ) {
89
return
htmlspecialchars( $date );
90
}
91
92
return
$this->
getLinkRenderer
()->makeLink(
93
SpecialPage::getTitleFor
(
'Undelete'
),
94
$date,
95
[],
96
[
97
'target'
=> $this->list->getPageName(),
98
'timestamp'
=> $this->revisionRecord->getTimestamp()
99
]
100
);
101
}
102
103
protected
function
getDiffLink
() {
104
if
( $this->
isDeleted
() && !$this->
canViewContent
() ) {
105
return
$this->list->msg(
'diff'
)->escaped();
106
}
107
108
return
$this->
getLinkRenderer
()->makeLink(
109
SpecialPage::getTitleFor
(
'Undelete'
),
110
$this->list->msg(
'diff'
)->text(),
111
[],
112
[
113
'target'
=> $this->list->getPageName(),
114
'diff'
=>
'prev'
,
115
'timestamp'
=> $this->revisionRecord->getTimestamp()
116
]
117
);
118
}
119
}
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition
GlobalFunctions.php:1891
MediaWiki\MediaWikiServices
Service locator for MediaWiki core services.
Definition
MediaWikiServices.php:223
RevDelArchiveItem
Item class for a archive table row.
Definition
RevDelArchiveItem.php:28
RevDelArchiveItem\getAuthorNameField
getAuthorNameField()
Get the DB field name storing user names.
Definition
RevDelArchiveItem.php:54
RevDelArchiveItem\getRevisionLink
getRevisionLink()
Get the HTML link to the revision text.
Definition
RevDelArchiveItem.php:84
RevDelArchiveItem\getId
getId()
Get the ID, as it would appear in the ids URL parameter.
Definition
RevDelArchiveItem.php:62
RevDelArchiveItem\getIdField
getIdField()
Get the DB field name associated with the ID list.
Definition
RevDelArchiveItem.php:42
RevDelArchiveItem\getDiffLink
getDiffLink()
Get the HTML link to the diff.
Definition
RevDelArchiveItem.php:103
RevDelArchiveItem\setBits
setBits( $bits)
Set the visibility of the item.
Definition
RevDelArchiveItem.php:67
RevDelArchiveItem\getAuthorIdField
getAuthorIdField()
Get the DB field name storing user ids.
Definition
RevDelArchiveItem.php:50
RevDelArchiveItem\getTimestampField
getTimestampField()
Get the DB field name storing timestamps.
Definition
RevDelArchiveItem.php:46
RevDelArchiveItem\initRevisionRecord
static initRevisionRecord( $list, $row)
Create RevisionRecord object from $row sourced from $list.
Definition
RevDelArchiveItem.php:29
RevDelArchiveItem\getAuthorActorField
getAuthorActorField()
Get the DB field name storing actor ids.
Definition
RevDelArchiveItem.php:58
RevDelRevisionItem
Definition
RevDelRevisionItem.php:31
RevDelRevisionItem\isDeleted
isDeleted()
Definition
RevDelRevisionItem.php:133
RevDelRevisionItem\canViewContent
canViewContent()
Returns true if the current user can view the item text/file.
Definition
RevDelRevisionItem.php:89
RevisionItemBase\$row
stdClass $row
The database result row.
Definition
RevisionItemBase.php:34
RevisionItemBase\$list
RevisionListBase $list
The parent.
Definition
RevisionItemBase.php:31
RevisionItemBase\getLinkRenderer
getLinkRenderer()
Returns an instance of LinkRenderer.
Definition
RevisionItemBase.php:178
RevisionListBase\getPage
getPage()
Definition
RevisionListBase.php:71
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Definition
SpecialPage.php:132
MediaWiki\Revision\RevisionFactory
Service for constructing RevisionRecord objects.
Definition
RevisionFactory.php:37
DB_PRIMARY
const DB_PRIMARY
Definition
defines.php:28
includes
revisiondelete
RevDelArchiveItem.php
Generated on Thu Jun 27 2024 14:04:02 for MediaWiki by
1.10.0