From bb497c97b67e948ce156d9cb738a9b3f926b9bbc Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Wed, 30 Jan 2013 16:05:17 +0100 Subject: [PATCH] misc style issues 7zip.inc : $stream is really a private property. userDupes.inc : still only used by MysqlUpdater, added a comment about it and made the properties private. sql.php : make sure we actually do nothing in some method. Previously we just had an empty IF statement. purgeList : a private method was named the same as the class, that is how we declared constructor with PHP4. Renamed it to doPurge() to make it clear that it is not the constructor. Rests are whitespaces fixes. Change-Id: I0b83f83ee3af37c770817ebfce3e804082c2fb41 --- maintenance/7zip.inc | 2 +- maintenance/benchmarks/bench_strtr_str_replace.php | 4 ++-- maintenance/purgeList.php | 4 ++-- maintenance/sql.php | 1 + maintenance/userDupes.inc | 12 ++++++++---- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/maintenance/7zip.inc b/maintenance/7zip.inc index 6bb06668c2..590cad238d 100644 --- a/maintenance/7zip.inc +++ b/maintenance/7zip.inc @@ -32,7 +32,7 @@ * @ingroup Maintenance */ class SevenZipStream { - var $stream; + protected $stream; private function stripPath( $path ) { $prefix = 'mediawiki.compress.7z://'; diff --git a/maintenance/benchmarks/bench_strtr_str_replace.php b/maintenance/benchmarks/bench_strtr_str_replace.php index 9fa7c8e3ba..10c5cd0b91 100644 --- a/maintenance/benchmarks/bench_strtr_str_replace.php +++ b/maintenance/benchmarks/bench_strtr_str_replace.php @@ -26,11 +26,11 @@ require_once( __DIR__ . '/Benchmarker.php' ); function bfNormalizeTitleStrTr( $str ) { - return strtr( $str, '_', ' ' ); + return strtr( $str, '_', ' ' ); } function bfNormalizeTitleStrReplace( $str ) { - return str_replace( '_', ' ', $str ); + return str_replace( '_', ' ', $str ); } /** diff --git a/maintenance/purgeList.php b/maintenance/purgeList.php index 58fe880148..d6baf4236e 100644 --- a/maintenance/purgeList.php +++ b/maintenance/purgeList.php @@ -41,13 +41,13 @@ class PurgeList extends Maintenance { if( $this->hasOption( 'namespace' ) ) { $this->purgeNamespace(); } else { - $this->purgeList(); + $this->doPurge(); } $this->output( "Done!\n" ); } /** Purge URL coming from stdin */ - private function purgeList() { + private function doPurge() { $stdin = $this->getStdin(); $urls = array(); diff --git a/maintenance/sql.php b/maintenance/sql.php index 72e6775b7a..9b0b576c65 100644 --- a/maintenance/sql.php +++ b/maintenance/sql.php @@ -105,6 +105,7 @@ class MwSql extends Maintenance { public function sqlPrintResult( $res, $db ) { if ( !$res ) { // Do nothing + return; } elseif ( is_object( $res ) && $res->numRows() ) { foreach ( $res as $row ) { $this->output( print_r( $row, true ) ); diff --git a/maintenance/userDupes.inc b/maintenance/userDupes.inc index 31bae8ed0b..be45a1116d 100644 --- a/maintenance/userDupes.inc +++ b/maintenance/userDupes.inc @@ -26,13 +26,17 @@ /** * Look for duplicate user table entries and optionally prune them. + * + * This is still used by our MysqlUpdater at: + * includes/installer/MysqlUpdater.php + * * @ingroup Maintenance */ class UserDupes { - var $db; - var $reassigned; - var $trimmed; - var $failed; + private $db; + private $reassigned; + private $trimmed; + private $failed; private $outputCallback; function __construct( &$database, $outputCallback ) { -- 2.20.1