From 62491fef1348820d73311cc8ac6f189d1f422667 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Wed, 16 Nov 2011 13:22:03 +0000 Subject: [PATCH] Comments, braces, explicit member variables Remove a couple of unused variables --- includes/LogEventsList.php | 11 ++++++++--- includes/StubObject.php | 9 ++++++++- includes/parser/Tidy.php | 12 ++++++------ includes/specials/SpecialBlock.php | 1 - maintenance/pruneFileCache.php | 3 +++ maintenance/updateCollation.php | 8 ++++---- tests/parser/parserTest.inc | 1 - 7 files changed, 29 insertions(+), 16 deletions(-) diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index f78da639e6..e73d0a6710 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -677,9 +677,10 @@ class LogEventsList { $logBody . $loglist->endLogEventsList(); } else { - if ( $showIfEmpty ) + if ( $showIfEmpty ) { $s = Html::rawElement( 'div', array( 'class' => 'mw-warning-logempty' ), wfMsgExt( 'logempty', array( 'parseinline' ) ) ); + } } if( $pager->getNumRows() > $pager->mLimit ) { # Show "Full log" link $urlParam = array(); @@ -706,7 +707,7 @@ class LogEventsList { $s .= ''; } - if ( $wrap!='' ) { // Wrap message in html + if ( $wrap != '' ) { // Wrap message in html $s = str_replace( '$1', $s, $wrap ); } @@ -992,7 +993,11 @@ class LogPager extends ReverseChronologicalPager { return $info; } - // Checks if $this->mConds has $field matched to a *single* value + /** + * Checks if $this->mConds has $field matched to a *single* value + * @param $field + * @return bool + */ protected function hasEqualsClause( $field ) { return ( array_key_exists( $field, $this->mConds ) && diff --git a/includes/StubObject.php b/includes/StubObject.php index be865e1e04..141de57f9d 100644 --- a/includes/StubObject.php +++ b/includes/StubObject.php @@ -90,8 +90,9 @@ class StubObject { function _unstub( $name = '_unstub', $level = 2 ) { static $recursionLevel = 0; - if ( !($GLOBALS[$this->mGlobal] instanceof StubObject) ) + if ( !($GLOBALS[$this->mGlobal] instanceof StubObject) ) { return $GLOBALS[$this->mGlobal]; // already unstubbed. + } if ( get_class( $GLOBALS[$this->mGlobal] ) != $this->mClass ) { $fname = __METHOD__.'-'.$this->mGlobal; @@ -124,6 +125,9 @@ class StubContLang extends StubObject { return $this->_call( $name, $args ); } + /** + * @return Language + */ function _newObject() { global $wgLanguageCode; $obj = Language::factory( $wgLanguageCode ); @@ -148,6 +152,9 @@ class StubUserLang extends StubObject { return $this->_call( $name, $args ); } + /** + * @return Language + */ function _newObject() { return RequestContext::getMain()->getLang(); } diff --git a/includes/parser/Tidy.php b/includes/parser/Tidy.php index 3a6d3e9ca8..2b98f01df7 100644 --- a/includes/parser/Tidy.php +++ b/includes/parser/Tidy.php @@ -11,7 +11,7 @@ * we may create a real postprocessor or something that will replace this. * It's called wrapper because for now it basically takes over MWTidy::tidy's task * of wrapping the text in a xhtml block - * + * * This re-uses some of the parser's UNIQ tricks, though some of it is private so it's * duplicated. Perhaps we should create an abstract marker hiding class. */ @@ -40,7 +40,7 @@ class MWTidyWrapper { $this->mUniqPrefix = "\x7fUNIQ" . dechex( mt_rand( 0, 0x7fffffff ) ) . dechex( mt_rand( 0, 0x7fffffff ) ); $this->mMarkerIndex = 0; - + $wrappedtext = preg_replace_callback( ParserOutput::EDITSECTION_REGEX, array( &$this, 'replaceEditSectionLinksCallback' ), $text ); @@ -126,7 +126,7 @@ class MWTidy { */ public static function checkErrors( $text, &$errorStr = null ) { global $wgTidyInternal; - + $retval = 0; if( $wgTidyInternal ) { $errorStr = self::execInternalTidy( $text, true, $retval ); @@ -166,7 +166,7 @@ class MWTidy { 2 => array( 'file', wfGetNull(), 'a' ) ); } - + $readpipe = $stderr ? 2 : 1; $pipes = array(); @@ -217,7 +217,7 @@ class MWTidy { if ( !MWInit::classExists( 'tidy' ) ) { wfWarn( "Unable to load internal tidy class." ); $retval = -1; - + wfProfileOut( __METHOD__ ); return null; } @@ -245,7 +245,7 @@ class MWTidy { "\n-->"; } } - + wfProfileOut( __METHOD__ ); return $cleansource; } diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index a53b1bbd2a..f35709f54c 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -297,7 +297,6 @@ class SpecialBlock extends FormSpecialPage { /** * Add header elements like block log entries, etc. - * @return void */ protected function preText(){ $text = $this->msg( 'blockiptext' )->parse(); diff --git a/maintenance/pruneFileCache.php b/maintenance/pruneFileCache.php index 11b6f997e2..f1a1cfd44c 100644 --- a/maintenance/pruneFileCache.php +++ b/maintenance/pruneFileCache.php @@ -23,6 +23,9 @@ require_once( dirname( __FILE__ ) . '/Maintenance.php' ); class PruneFileCache extends Maintenance { + + protected $minSurviveTimestamp; + public function __construct() { parent::__construct(); $this->mDescription = "Build file cache for content pages"; diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 7e8a7ee009..023409fa8f 100644 --- a/maintenance/updateCollation.php +++ b/maintenance/updateCollation.php @@ -43,7 +43,7 @@ using the page title and cl_sortkey_prefix. If everything's collation is up-to-date, it will do nothing. TEXT; - $this->addOption( 'force', 'Run on all rows, even if the collation is ' . + $this->addOption( 'force', 'Run on all rows, even if the collation is ' . 'supposed to be up-to-date.' ); $this->addOption( 'previous-collation', 'Set the previous value of ' . '$wgCategoryCollation here to speed up this script, especially if your ' . @@ -111,7 +111,7 @@ TEXT; # This is an old-style row, so the sortkey needs to be # converted. if ( $row->cl_sortkey == $title->getText() - || $row->cl_sortkey == $title->getPrefixedText() ) { + || $row->cl_sortkey == $title->getPrefixedText() ) { $prefix = ''; } else { # Custom sortkey, use it as a prefix @@ -148,14 +148,14 @@ TEXT; if ( $force && $row ) { $encFrom = $dbw->addQuotes( $row->cl_from ); $encTo = $dbw->addQuotes( $row->cl_to ); - $batchConds = array( + $batchConds = array( "(cl_from = $encFrom AND cl_to > $encTo) " . " OR cl_from > $encFrom" ); } $count += $res->numRows(); $this->output( "$count done.\n" ); - + if ( ++$batchCount % self::SYNC_INTERVAL == 0 ) { $this->output( "Waiting for slaves ... " ); wfWaitForSlaves(); diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index af0d4bf4bd..b9fd221217 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -766,7 +766,6 @@ class ParserTest { } $temporary = $this->useTemporaryTables || $dbType == 'postgres'; - $tables = $this->listTables(); $prefix = $dbType != 'oracle' ? 'parsertest_' : 'pt_'; $this->dbClone = new CloneDatabase( $this->db, $this->listTables(), $prefix ); -- 2.20.1