Page MenuHomeMiraheze
Paste P450

fixRC.php
ActivePublic

Authored by RhinosF1 on Jan 17 2022, 16:24.
Tags
None
Referenced Files
F1706744: fixRC.php
Jan 17 2022, 16:51
F1706736: fixRC.php
Jan 17 2022, 16:32
F1706733: fixRC.php
Jan 17 2022, 16:26
F1706732: fixRC.php
Jan 17 2022, 16:26
F1706730: fixRC.php
Jan 17 2022, 16:24
Subscribers
None
<?php
require_once __DIR__ . '/../../../maintenance/Maintenance.php';
use MediaWiki\MediaWikiServices;
class FixRCDupes extends Maintenance {
public function __construct() {
parent::__construct();
}
/**
* @return bool
*/
public function execute() {
$lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
$dbr = $lbFactory->getMainLB()->getConnection( DB_PRIMARY );
$res = $dbr->query('SELECT rc_this_oldid FROM recentchanges GROUP BY rc_this_oldid HAVING COUNT(rc_this_oldid) > 1');
foreach ($res as $row) {
$dbr->query(' DELETE from recentchanges where rc_this_oldid = ' . $row->rc_this_oldid . 'LIMIT 1');
}
}
}
$maintClass = FixRCDupes::class;
require_once RUN_MAINTENANCE_IF_MAIN;