Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5952000
GlobalRenameUserLogger.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
GlobalRenameUserLogger.php
View Options
<?php
namespace
MediaWiki\Extension\CentralAuth\GlobalRename
;
use
MediaWiki\Logging\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
)
{
// The following message is generated here:
// * logentry-gblrename-rename
$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
)
{
// The following message is generated here:
// * logentry-gblrename-promote
$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
Oct 3 2026, 01:10 (4 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
5b/c5/2b1931239c0302b022de7e358a46
Default Alt Text
GlobalRenameUserLogger.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment