Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5971173
GlobalRenameUserLogger.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
GlobalRenameUserLogger.php
View Options
<?php
namespace
MediaWiki\Extension\CentralAuth\GlobalRename
;
use
ManualLogEntry
;
use
MediaWiki\SpecialPage\SpecialPage
;
use
MediaWiki\User\UserIdentity
;
/**
* Log a global rename into the local log
*
* @license GPL-2.0-or-later
* @author Marius Hoch < hoo@online.de >
*/
class
GlobalRenameUserLogger
{
private
UserIdentity
$performingUser
;
public
function
__construct
(
UserIdentity
$performingUser
)
{
$this
->
performingUser
=
$performingUser
;
}
/**
* @param string $oldName
* @param string $newName
* @param array $options
*/
public
function
log
(
$oldName
,
$newName
,
$options
)
{
$logEntry
=
new
ManualLogEntry
(
'gblrename'
,
'rename'
);
$logEntry
->
setPerformer
(
$this
->
performingUser
);
$logEntry
->
setTarget
(
SpecialPage
::
getTitleFor
(
'CentralAuth'
,
$newName
)
);
$logEntry
->
setComment
(
$options
[
'reason'
]
);
$logEntry
->
setParameters
(
[
'4::olduser'
=>
$oldName
,
'5::newuser'
=>
$newName
,
'movepages'
=>
$options
[
'movepages'
],
'suppressredirects'
=>
$options
[
'suppressredirects'
],
]
);
$logEntry
->
setRelations
(
[
'oldname'
=>
$oldName
,
]
);
$logid
=
$logEntry
->
insert
();
$logEntry
->
publish
(
$logid
);
}
/**
* Log the promotion of a local unattached to a global
*
* @param string $oldName
* @param string $wiki
* @param string $newName
* @param string $reason
*/
public
function
logPromotion
(
$oldName
,
$wiki
,
$newName
,
$reason
)
{
$logEntry
=
new
ManualLogEntry
(
'gblrename'
,
'promote'
);
$logEntry
->
setPerformer
(
$this
->
performingUser
);
$logEntry
->
setTarget
(
SpecialPage
::
getTitleFor
(
'CentralAuth'
,
$newName
)
);
$logEntry
->
setComment
(
$reason
);
$logEntry
->
setParameters
(
[
'4::olduser'
=>
$oldName
,
'5::newuser'
=>
$newName
,
'6::oldwiki'
=>
$wiki
,
]
);
$logEntry
->
setRelations
(
[
'oldname'
=>
$oldName
,
]
);
$logid
=
$logEntry
->
insert
();
$logEntry
->
publish
(
$logid
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 15:00 (1 d, 21 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
2f/ce/ffa8ef90c2dffe55dea528d35d35
Default Alt Text
GlobalRenameUserLogger.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment