Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5954157
GlobalRenameUserDatabaseUpdates.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
GlobalRenameUserDatabaseUpdates.php
View Options
<?php
namespace
MediaWiki\Extension\CentralAuth\GlobalRename
;
use
MediaWiki\Extension\CentralAuth\CentralAuthDatabaseManager
;
/**
* Update the rows in the CentralAuth tables during a rename
*
* @license GPL-2.0-or-later
* @author Marius Hoch < hoo@online.de >
*/
class
GlobalRenameUserDatabaseUpdates
{
private
CentralAuthDatabaseManager
$databaseManager
;
public
function
__construct
(
CentralAuthDatabaseManager
$databaseManager
)
{
$this
->
databaseManager
=
$databaseManager
;
}
/**
* @param string $oldname
* @param string $newname
* @param int|null $type
*/
public
function
update
(
$oldname
,
$newname
,
$type
=
GlobalRenameRequest
::
RENAME
)
{
$dbw
=
$this
->
databaseManager
->
getCentralPrimaryDB
();
$data
=
[
'gu_name'
=>
$newname
];
if
(
$type
===
GlobalRenameRequest
::
VANISH
)
{
// Vanish requests need to remove user's email
$data
[
'gu_email'
]
=
''
;
}
$dbw
->
startAtomic
(
__METHOD__
);
$dbw
->
newUpdateQueryBuilder
()
->
update
(
'globaluser'
)
->
set
(
$data
)
->
where
(
[
'gu_name'
=>
$oldname
]
)
->
caller
(
__METHOD__
)
->
execute
();
$dbw
->
newDeleteQueryBuilder
()
->
deleteFrom
(
'localuser'
)
->
where
(
[
'lu_name'
=>
$oldname
]
)
->
caller
(
__METHOD__
)
->
execute
();
$dbw
->
endAtomic
(
__METHOD__
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 02:45 (3 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
8d/08/6855efb06605beabbb4adb4940d5
Default Alt Text
GlobalRenameUserDatabaseUpdates.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment