[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Summary view] [Print] [Text view]
1 <?php 2 require_once __DIR__ . '/Maintenance.php'; 3 4 /** 5 * Fixes all rows affected by https://bugzilla.wikimedia.org/show_bug.cgi?id=37714 6 */ 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 = wfGetDB( DB_SLAVE )->select( 11 'logging', 12 array( 'log_id', 'log_params' ), 13 array( 14 'log_type' => array( '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 $paramLines = explode( "\n", $row->log_params ); 24 $ids = explode( ',', $paramLines[0] ); // Array dereferencing is PHP >= 5.4 :( 25 $result = wfGetDB( DB_SLAVE )->select( // Work out what log entries were changed here. 26 'logging', 27 'log_type', 28 array( 'log_id' => $ids ), 29 __METHOD__, 30 'DISTINCT' 31 ); 32 if ( $result->numRows() === 1 ) { 33 // If there's only one type, the target title can be set to include it. 34 $logTitle = SpecialPage::getTitleFor( 'Log', $result->current()->log_type )->getText(); 35 $this->output( 'Set log_title to "' . $logTitle . '" for log entry ' . $row->log_id . ".\n" ); 36 wfGetDB( DB_MASTER )->update( 37 'logging', 38 array( 'log_title' => $logTitle ), 39 array( 'log_id' => $row->log_id ), 40 __METHOD__ 41 ); 42 wfWaitForSlaves(); 43 } 44 } 45 } 46 } 47 48 $maintClass = 'TidyUpBug37714'; 49 require_once RUN_MAINTENANCE_IF_MAIN;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |