MediaWiki REL1_30
tidyUpBug37714.php
Go to the documentation of this file.
1<?php
2require_once __DIR__ . '/Maintenance.php';
3
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_REPLICA )->select(
11 'logging',
12 [ 'log_id', 'log_params' ],
13 [
14 'log_type' => [ 'suppress', 'delete' ],
15 'log_action' => 'event',
16 'log_namespace' => NS_SPECIAL,
17 'log_title' => SpecialPage::getTitleFor( 'Log' )->getText()
18 ],
19 __METHOD__
20 );
21
22 foreach ( $result as $row ) {
23 $ids = explode( ',', explode( "\n", $row->log_params )[0] );
24 $result = $this->getDB( DB_REPLICA )->select( // Work out what log entries were changed here.
25 'logging',
26 'log_type',
27 [ 'log_id' => $ids ],
28 __METHOD__,
29 'DISTINCT'
30 );
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(
36 'logging',
37 [ 'log_title' => $logTitle ],
38 [ 'log_id' => $row->log_id ],
39 __METHOD__
40 );
42 }
43 }
44 }
45}
46
47$maintClass = 'TidyUpBug37714';
48require_once RUN_MAINTENANCE_IF_MAIN;
wfWaitForSlaves( $ifWritesSince=null, $wiki=false, $cluster=false, $timeout=null)
Waits for the replica DBs to catch up to the master position.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Fixes all rows affected by https://bugzilla.wikimedia.org/show_bug.cgi?id=37714.
execute()
Do the actual work.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful
const NS_SPECIAL
Definition Defines.php:54
require_once RUN_MAINTENANCE_IF_MAIN
const DB_REPLICA
Definition defines.php:25
const DB_MASTER
Definition defines.php:26
$maintClass