Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4075161
populateGlobalRenameLogSearch.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
populateGlobalRenameLogSearch.php
View Options
<?php
namespace
MediaWiki\Extension\CentralAuth\Maintenance
;
use
LogEntryBase
;
use
MediaWiki\Maintenance\Maintenance
;
$IP
=
getenv
(
'MW_INSTALL_PATH'
);
if
(
$IP
===
false
)
{
$IP
=
__DIR__
.
'/../../..'
;
}
require_once
"$IP/maintenance/Maintenance.php"
;
/**
* Script to back-populate log_search for global rename entries
*/
class
PopulateGlobalRenameLogSearch
extends
Maintenance
{
public
function
__construct
()
{
parent
::
__construct
();
$this
->
requireExtension
(
'CentralAuth'
);
$this
->
setBatchSize
(
50
);
}
public
function
execute
()
{
$dbr
=
$this
->
getDB
(
DB_REPLICA
);
$rows
=
$dbr
->
newSelectQueryBuilder
()
->
select
(
[
'log_id'
,
'log_params'
]
)
->
from
(
'logging'
)
->
leftJoin
(
'log_search'
,
null
,
'log_id=ls_log_id'
)
->
where
(
[
'log_type'
=>
'gblrename'
,
'log_action'
=>
'rename'
,
'ls_field'
=>
null
,
]
)
->
caller
(
__METHOD__
)
->
fetchResultSet
();
$insert
=
[];
foreach
(
$rows
as
$row
)
{
$params
=
LogEntryBase
::
extractParams
(
$row
->
log_params
);
$insert
[]
=
[
'ls_field'
=>
'oldname'
,
'ls_value'
=>
$params
[
'4::olduser'
],
'ls_log_id'
=>
$row
->
log_id
,
];
if
(
count
(
$insert
)
>=
$this
->
mBatchSize
)
{
$this
->
insert
(
$insert
);
$insert
=
[];
}
}
if
(
$insert
)
{
$this
->
insert
(
$insert
);
}
}
/**
* @param array $rows
*/
private
function
insert
(
array
$rows
)
{
$count
=
count
(
$rows
);
$this
->
output
(
"Inserting $count rows into log_search
\n
"
);
$dbw
=
$this
->
getPrimaryDB
();
$dbw
->
newInsertQueryBuilder
()
->
insertInto
(
'log_search'
)
->
ignore
()
->
rows
(
$rows
)
->
caller
(
__METHOD__
)
->
execute
();
$this
->
waitForReplication
();
}
}
$maintClass
=
PopulateGlobalRenameLogSearch
::
class
;
require_once
RUN_MAINTENANCE_IF_MAIN
;
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 17 2026, 17:49 (10 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d5/a5/eac35860e8eee214524daa2c511e
Default Alt Text
populateGlobalRenameLogSearch.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment