2 require_once __DIR__
. '/Maintenance.php';
5 * Fixes all rows affected by https://bugzilla.wikimedia.org/show_bug.cgi?id=37714
7 class TidyUpBug37714
extends Maintenance
{
8 public function execute() {
9 // Search for all log entries which are about changing the visability of other log entries.
10 $result = $this->getDB( DB_SLAVE
)->select(
12 [ 'log_id', 'log_params' ],
14 'log_type' => [ 'suppress', 'delete' ],
15 'log_action' => 'event',
16 'log_namespace' => NS_SPECIAL
,
17 'log_title' => SpecialPage
::getTitleFor( 'Log' )->getText()
22 foreach ( $result as $row ) {
23 $ids = explode( ',', explode( "\n", $row->log_params
)[0] );
24 $result = $this->getDB( DB_SLAVE
)->select( // Work out what log entries were changed here.
31 if ( $result->numRows() === 1 ) {
32 // If there's only one type, the target title can be set to include it.
33 $logTitle = SpecialPage
::getTitleFor( 'Log', $result->current()->log_type
)->getText();
34 $this->output( 'Set log_title to "' . $logTitle . '" for log entry ' . $row->log_id
. ".\n" );
35 $this->getDB( DB_MASTER
)->update(
37 [ 'log_title' => $logTitle ],
38 [ 'log_id' => $row->log_id
],
47 $maintClass = 'TidyUpBug37714';
48 require_once RUN_MAINTENANCE_IF_MAIN
;