Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1425717
RCDatabaseLogEntry.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
RCDatabaseLogEntry.php
View Options
<?php
/**
* Contains a class for dealing with recent changes database log entries
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @author Niklas Laxström
* @license GPL-2.0-or-later
* @since 1.19
*/
use
MediaWiki\Logger\LoggerFactory
;
use
MediaWiki\MediaWikiServices
;
use
MediaWiki\Title\Title
;
use
MediaWiki\User\UserIdentity
;
use
Wikimedia\Rdbms\IReadableDatabase
;
/**
* A subclass of DatabaseLogEntry for objects constructed from entries in the
* recentchanges table (rather than the logging table).
*
* This class should only be used in context of the LogFormatter class.
*/
class
RCDatabaseLogEntry
extends
DatabaseLogEntry
{
public
static
function
newFromId
(
$id
,
IReadableDatabase
$db
)
{
// @phan-suppress-previous-line PhanPluginNeverReturnMethod
// Make the LSP violation explicit to prevent sneaky failures
throw
new
LogicException
(
'Not implemented!'
);
}
public
static
function
getSelectQueryData
()
{
// @phan-suppress-previous-line PhanPluginNeverReturnMethod
// Make the LSP violation explicit to prevent sneaky failures
throw
new
LogicException
(
'Not implemented!'
);
}
public
function
getId
()
{
return
$this
->
row
->
rc_logid
;
}
protected
function
getRawParameters
()
{
return
$this
->
row
->
rc_params
;
}
public
function
getAssociatedRevId
()
{
return
$this
->
row
->
rc_this_oldid
;
}
public
function
getType
()
{
return
$this
->
row
->
rc_log_type
;
}
public
function
getSubtype
()
{
return
$this
->
row
->
rc_log_action
;
}
public
function
getPerformerIdentity
():
UserIdentity
{
if
(
!
$this
->
performer
)
{
$actorStore
=
MediaWikiServices
::
getInstance
()->
getActorStore
();
$userFactory
=
MediaWikiServices
::
getInstance
()->
getUserFactory
();
if
(
isset
(
$this
->
row
->
rc_actor
)
)
{
try
{
$this
->
performer
=
$actorStore
->
newActorFromRowFields
(
$this
->
row
->
rc_user
??
0
,
$this
->
row
->
rc_user_text
,
$this
->
row
->
rc_actor
);
}
catch
(
InvalidArgumentException
$e
)
{
$this
->
performer
=
$actorStore
->
getUnknownActor
();
LoggerFactory
::
getInstance
(
'logentry'
)->
warning
(
'Failed to instantiate RC log entry performer'
,
[
'exception'
=>
$e
,
'log_id'
=>
$this
->
getId
()
]
);
}
}
elseif
(
isset
(
$this
->
row
->
rc_user
)
)
{
$this
->
performer
=
$userFactory
->
newFromId
(
$this
->
row
->
rc_user
)->
getUser
();
}
elseif
(
isset
(
$this
->
row
->
rc_user_text
)
)
{
$user
=
$userFactory
->
newFromName
(
$this
->
row
->
rc_user_text
);
if
(
$user
)
{
$this
->
performer
=
$user
->
getUser
();
}
else
{
$this
->
performer
=
$actorStore
->
getUnknownActor
();
LoggerFactory
::
getInstance
(
'logentry'
)->
warning
(
'Failed to instantiate RC log entry performer'
,
[
'rc_user_text'
=>
$this
->
row
->
rc_user_text
,
'log_id'
=>
$this
->
getId
()
]
);
}
}
}
return
$this
->
performer
;
}
public
function
getTarget
()
{
$namespace
=
$this
->
row
->
rc_namespace
;
$page
=
$this
->
row
->
rc_title
;
return
Title
::
makeTitle
(
$namespace
,
$page
);
}
public
function
getTimestamp
()
{
return
wfTimestamp
(
TS_MW
,
$this
->
row
->
rc_timestamp
);
}
public
function
getComment
()
{
$services
=
MediaWikiServices
::
getInstance
();
return
$services
->
getCommentStore
()
// Legacy because the row may have used RecentChange::selectFields()
->
getCommentLegacy
(
$services
->
getConnectionProvider
()->
getReplicaDatabase
(),
'rc_comment'
,
$this
->
row
)->
text
;
}
public
function
getDeleted
()
{
return
$this
->
row
->
rc_deleted
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 11:52 (18 h, 26 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
25/64/ae9ba8df12abbac0d67b290826b2
Default Alt Text
RCDatabaseLogEntry.php (4 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment