From a318aecb0eed10c8f4b20c1ba5948cc0a51aa1be Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Tue, 8 Oct 2013 19:11:35 +0200 Subject: [PATCH] Fix PHP CodeSniffer warnings and errors Also apply formatting convention. Change-Id: I792210d0d1c5f9089a71cecba95e17822f6da0e3 --- maintenance/cleanupTable.inc | 5 ++--- maintenance/cleanupTitles.php | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/maintenance/cleanupTable.inc b/maintenance/cleanupTable.inc index 48bb53ebd1..cbd1be6b80 100644 --- a/maintenance/cleanupTable.inc +++ b/maintenance/cleanupTable.inc @@ -109,8 +109,8 @@ class TableCleanup extends Maintenance { $dbr = wfGetDB( DB_SLAVE ); if ( array_diff( array_keys( $params ), - array( 'table', 'conds', 'index', 'callback' ) ) ) - { + array( 'table', 'conds', 'index', 'callback' ) ) + ) { throw new MWException( __METHOD__ . ': Missing parameter ' . implode( ', ', $params ) ); } @@ -120,7 +120,6 @@ class TableCleanup extends Maintenance { $this->init( $count, $table ); $this->output( "Processing $table...\n" ); - $index = (array)$params['index']; $indexConds = array(); $options = array( diff --git a/maintenance/cleanupTitles.php b/maintenance/cleanupTitles.php index ae256ab188..5b5ef18453 100644 --- a/maintenance/cleanupTitles.php +++ b/maintenance/cleanupTitles.php @@ -54,9 +54,10 @@ class TitleCleanup extends TableCleanup { if ( !is_null( $title ) && $title->canExist() && $title->getNamespace() == $row->page_namespace - && $title->getDBkey() === $row->page_title ) - { - $this->progress( 0 ); // all is fine + && $title->getDBkey() === $row->page_title + ) { + $this->progress( 0 ); // all is fine + return; } @@ -83,6 +84,7 @@ class TitleCleanup extends TableCleanup { // This is reasonable, since cleanupImages.php only iterates over the image table. $dbr = wfGetDB( DB_SLAVE ); $row = $dbr->selectRow( 'image', array( 'img_name' ), array( 'img_name' => $name ), __METHOD__ ); + return $row !== false; } @@ -115,9 +117,11 @@ class TitleCleanup extends TableCleanup { $dest = $title->getDBkey(); if ( $this->dryrun ) { - $this->output( "DRY RUN: would rename $row->page_id ($row->page_namespace,'$row->page_title') to ($row->page_namespace,'$dest')\n" ); + $this->output( "DRY RUN: would rename $row->page_id ($row->page_namespace," . + "'$row->page_title') to ($row->page_namespace,'$dest')\n" ); } else { - $this->output( "renaming $row->page_id ($row->page_namespace,'$row->page_title') to ($row->page_namespace,'$dest')\n" ); + $this->output( "renaming $row->page_id ($row->page_namespace," . + "'$row->page_title') to ($row->page_namespace,'$dest')\n" ); $dbw = wfGetDB( DB_MASTER ); $dbw->update( 'page', array( 'page_title' => $dest ), @@ -160,9 +164,11 @@ class TitleCleanup extends TableCleanup { $dest = $title->getDBkey(); if ( $this->dryrun ) { - $this->output( "DRY RUN: would rename $row->page_id ($row->page_namespace,'$row->page_title') to ($ns,'$dest')\n" ); + $this->output( "DRY RUN: would rename $row->page_id ($row->page_namespace," . + "'$row->page_title') to ($ns,'$dest')\n" ); } else { - $this->output( "renaming $row->page_id ($row->page_namespace,'$row->page_title') to ($ns,'$dest')\n" ); + $this->output( "renaming $row->page_id ($row->page_namespace," . + "'$row->page_title') to ($ns,'$dest')\n" ); $dbw = wfGetDB( DB_MASTER ); $dbw->update( 'page', array( -- 2.20.1