X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FtidyUpBug37714.php;h=0dd0341d3c35d0fc63e4c3093e36e4a39b6b51aa;hb=5490b1270a0a7447f28d2407736fc3c1deb41d44;hp=1ad9c7ee25d1d736e0a0aad3d74961c7b9dae7dc;hpb=202de82bb1118299e723ef08c37bdd93eaa770dc;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/tidyUpBug37714.php b/maintenance/tidyUpBug37714.php index 1ad9c7ee25..0dd0341d3c 100644 --- a/maintenance/tidyUpBug37714.php +++ b/maintenance/tidyUpBug37714.php @@ -7,25 +7,24 @@ require_once __DIR__ . '/Maintenance.php'; class TidyUpBug37714 extends Maintenance { public function execute() { // Search for all log entries which are about changing the visability of other log entries. - $result = wfGetDB( DB_SLAVE )->select( + $result = $this->getDB( DB_REPLICA )->select( 'logging', - array( 'log_id', 'log_params' ), - array( - 'log_type' => array( 'suppress', 'delete' ), + [ 'log_id', 'log_params' ], + [ + 'log_type' => [ 'suppress', 'delete' ], 'log_action' => 'event', 'log_namespace' => NS_SPECIAL, 'log_title' => SpecialPage::getTitleFor( 'Log' )->getText() - ), + ], __METHOD__ ); foreach ( $result as $row ) { - $paramLines = explode( "\n", $row->log_params ); - $ids = explode( ',', $paramLines[0] ); // Array dereferencing is PHP >= 5.4 :( - $result = wfGetDB( DB_SLAVE )->select( // Work out what log entries were changed here. + $ids = explode( ',', explode( "\n", $row->log_params )[0] ); + $result = $this->getDB( DB_REPLICA )->select( // Work out what log entries were changed here. 'logging', 'log_type', - array( 'log_id' => $ids ), + [ 'log_id' => $ids ], __METHOD__, 'DISTINCT' ); @@ -33,10 +32,10 @@ class TidyUpBug37714 extends Maintenance { // If there's only one type, the target title can be set to include it. $logTitle = SpecialPage::getTitleFor( 'Log', $result->current()->log_type )->getText(); $this->output( 'Set log_title to "' . $logTitle . '" for log entry ' . $row->log_id . ".\n" ); - wfGetDB( DB_MASTER )->update( + $this->getDB( DB_MASTER )->update( 'logging', - array( 'log_title' => $logTitle ), - array( 'log_id' => $row->log_id ), + [ 'log_title' => $logTitle ], + [ 'log_id' => $row->log_id ], __METHOD__ ); wfWaitForSlaves(); @@ -45,5 +44,5 @@ class TidyUpBug37714 extends Maintenance { } } -$maintClass = 'TidyUpBug37714'; +$maintClass = TidyUpBug37714::class; require_once RUN_MAINTENANCE_IF_MAIN;