Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P35437
(An Untitled Masterwork)
Active
Public
Actions
Authored by
Ladsgroup
on Oct 12 2022, 2:14 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F35564685: raw-paste-data.txt
Oct 12 2022, 2:14 PM
2022-10-12 14:14:34 (UTC+0)
Subscribers
None
<?php
/**
* Cleans up user blocks with user names not matching the 'user' table
*
* 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
* @ingroup Maintenance
*/
require_once
__DIR__
.
'/Maintenance.php'
;
/**
* Maintenance script to clean up user blocks with user names not matching the
* 'user' table.
*
* @ingroup Maintenance
*/
class
TestReconfigureMaint
extends
Maintenance
{
public
function
__construct
()
{
parent
::
__construct
();
$this
->
addDescription
(
"Cleanup user blocks with user names not matching the 'user' table"
);
}
public
function
execute
()
{
$db
=
$this
->
getDB
(
DB_REPLICA
);
while
(
true
)
{
$max
=
$db
->
newSelectQueryBuilder
()
->
select
(
'MAX(rev_id)'
)
->
from
(
'revision'
)
->
caller
(
__METHOD__
)
->
fetchField
();
$this
->
output
(
$max
.
"
\n
"
);
$this
->
output
(
$db
->
getServerName
()
.
"
\n
"
);
\MediaWiki\MediaWikiServices
::
getInstance
()->
getDBLoadBalancerFactory
()->
autoReconfigure
();
sleep
(
30
);
}
}
}
$maintClass
=
TestReconfigureMaint
::
class
;
require_once
RUN_MAINTENANCE_IF_MAIN
;
Event Timeline
Ladsgroup
created this paste.
Oct 12 2022, 2:14 PM
2022-10-12 14:14:34 (UTC+0)
Ladsgroup
mentioned this in
T298485: MW scripts should reload the database config
.
Log In to Comment