r103323 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103322‎ | r103323 | r103324 >
Date:13:22, 16 November 2011
Author:reedy
Status:ok
Tags:
Comment:
Comments, braces, explicit member variables

Remove a couple of unused variables
Modified paths:
  • /trunk/extensions/ParserFunctions/ParserFunctions.php (modified) (history)
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)
  • /trunk/phase3/includes/StubObject.php (modified) (history)
  • /trunk/phase3/includes/parser/Tidy.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialBlock.php (modified) (history)
  • /trunk/phase3/maintenance/pruneFileCache.php (modified) (history)
  • /trunk/phase3/maintenance/updateCollation.php (modified) (history)
  • /trunk/phase3/tests/parser/parserTest.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/updateCollation.php
@@ -43,7 +43,7 @@
4444 up-to-date, it will do nothing.
4545 TEXT;
4646
47 - $this->addOption( 'force', 'Run on all rows, even if the collation is ' .
 47+ $this->addOption( 'force', 'Run on all rows, even if the collation is ' .
4848 'supposed to be up-to-date.' );
4949 $this->addOption( 'previous-collation', 'Set the previous value of ' .
5050 '$wgCategoryCollation here to speed up this script, especially if your ' .
@@ -111,7 +111,7 @@
112112 # This is an old-style row, so the sortkey needs to be
113113 # converted.
114114 if ( $row->cl_sortkey == $title->getText()
115 - || $row->cl_sortkey == $title->getPrefixedText() ) {
 115+ || $row->cl_sortkey == $title->getPrefixedText() ) {
116116 $prefix = '';
117117 } else {
118118 # Custom sortkey, use it as a prefix
@@ -148,14 +148,14 @@
149149 if ( $force && $row ) {
150150 $encFrom = $dbw->addQuotes( $row->cl_from );
151151 $encTo = $dbw->addQuotes( $row->cl_to );
152 - $batchConds = array(
 152+ $batchConds = array(
153153 "(cl_from = $encFrom AND cl_to > $encTo) " .
154154 " OR cl_from > $encFrom" );
155155 }
156156
157157 $count += $res->numRows();
158158 $this->output( "$count done.\n" );
159 -
 159+
160160 if ( ++$batchCount % self::SYNC_INTERVAL == 0 ) {
161161 $this->output( "Waiting for slaves ... " );
162162 wfWaitForSlaves();
Index: trunk/phase3/maintenance/pruneFileCache.php
@@ -23,6 +23,9 @@
2424 require_once( dirname( __FILE__ ) . '/Maintenance.php' );
2525
2626 class PruneFileCache extends Maintenance {
 27+
 28+ protected $minSurviveTimestamp;
 29+
2730 public function __construct() {
2831 parent::__construct();
2932 $this->mDescription = "Build file cache for content pages";
Index: trunk/phase3/tests/parser/parserTest.inc
@@ -766,7 +766,6 @@
767767 }
768768
769769 $temporary = $this->useTemporaryTables || $dbType == 'postgres';
770 - $tables = $this->listTables();
771770 $prefix = $dbType != 'oracle' ? 'parsertest_' : 'pt_';
772771
773772 $this->dbClone = new CloneDatabase( $this->db, $this->listTables(), $prefix );
Index: trunk/phase3/includes/StubObject.php
@@ -90,8 +90,9 @@
9191 function _unstub( $name = '_unstub', $level = 2 ) {
9292 static $recursionLevel = 0;
9393
94 - if ( !($GLOBALS[$this->mGlobal] instanceof StubObject) )
 94+ if ( !($GLOBALS[$this->mGlobal] instanceof StubObject) ) {
9595 return $GLOBALS[$this->mGlobal]; // already unstubbed.
 96+ }
9697
9798 if ( get_class( $GLOBALS[$this->mGlobal] ) != $this->mClass ) {
9899 $fname = __METHOD__.'-'.$this->mGlobal;
@@ -124,6 +125,9 @@
125126 return $this->_call( $name, $args );
126127 }
127128
 129+ /**
 130+ * @return Language
 131+ */
128132 function _newObject() {
129133 global $wgLanguageCode;
130134 $obj = Language::factory( $wgLanguageCode );
@@ -148,6 +152,9 @@
149153 return $this->_call( $name, $args );
150154 }
151155
 156+ /**
 157+ * @return Language
 158+ */
152159 function _newObject() {
153160 return RequestContext::getMain()->getLang();
154161 }
Index: trunk/phase3/includes/parser/Tidy.php
@@ -11,7 +11,7 @@
1212 * we may create a real postprocessor or something that will replace this.
1313 * It's called wrapper because for now it basically takes over MWTidy::tidy's task
1414 * of wrapping the text in a xhtml block
15 - *
 15+ *
1616 * This re-uses some of the parser's UNIQ tricks, though some of it is private so it's
1717 * duplicated. Perhaps we should create an abstract marker hiding class.
1818 */
@@ -40,7 +40,7 @@
4141 $this->mUniqPrefix = "\x7fUNIQ" .
4242 dechex( mt_rand( 0, 0x7fffffff ) ) . dechex( mt_rand( 0, 0x7fffffff ) );
4343 $this->mMarkerIndex = 0;
44 -
 44+
4545 $wrappedtext = preg_replace_callback( ParserOutput::EDITSECTION_REGEX,
4646 array( &$this, 'replaceEditSectionLinksCallback' ), $text );
4747
@@ -126,7 +126,7 @@
127127 */
128128 public static function checkErrors( $text, &$errorStr = null ) {
129129 global $wgTidyInternal;
130 -
 130+
131131 $retval = 0;
132132 if( $wgTidyInternal ) {
133133 $errorStr = self::execInternalTidy( $text, true, $retval );
@@ -166,7 +166,7 @@
167167 2 => array( 'file', wfGetNull(), 'a' )
168168 );
169169 }
170 -
 170+
171171 $readpipe = $stderr ? 2 : 1;
172172 $pipes = array();
173173
@@ -217,7 +217,7 @@
218218 if ( !MWInit::classExists( 'tidy' ) ) {
219219 wfWarn( "Unable to load internal tidy class." );
220220 $retval = -1;
221 -
 221+
222222 wfProfileOut( __METHOD__ );
223223 return null;
224224 }
@@ -245,7 +245,7 @@
246246 "\n-->";
247247 }
248248 }
249 -
 249+
250250 wfProfileOut( __METHOD__ );
251251 return $cleansource;
252252 }
Index: trunk/phase3/includes/LogEventsList.php
@@ -677,9 +677,10 @@
678678 $logBody .
679679 $loglist->endLogEventsList();
680680 } else {
681 - if ( $showIfEmpty )
 681+ if ( $showIfEmpty ) {
682682 $s = Html::rawElement( 'div', array( 'class' => 'mw-warning-logempty' ),
683683 wfMsgExt( 'logempty', array( 'parseinline' ) ) );
 684+ }
684685 }
685686 if( $pager->getNumRows() > $pager->mLimit ) { # Show "Full log" link
686687 $urlParam = array();
@@ -706,7 +707,7 @@
707708 $s .= '</div>';
708709 }
709710
710 - if ( $wrap!='' ) { // Wrap message in html
 711+ if ( $wrap != '' ) { // Wrap message in html
711712 $s = str_replace( '$1', $s, $wrap );
712713 }
713714
@@ -992,7 +993,11 @@
993994 return $info;
994995 }
995996
996 - // Checks if $this->mConds has $field matched to a *single* value
 997+ /**
 998+ * Checks if $this->mConds has $field matched to a *single* value
 999+ * @param $field
 1000+ * @return bool
 1001+ */
9971002 protected function hasEqualsClause( $field ) {
9981003 return (
9991004 array_key_exists( $field, $this->mConds ) &&
Index: trunk/phase3/includes/specials/SpecialBlock.php
@@ -297,7 +297,6 @@
298298
299299 /**
300300 * Add header elements like block log entries, etc.
301 - * @return void
302301 */
303302 protected function preText(){
304303 $text = $this->msg( 'blockiptext' )->parse();
Index: trunk/extensions/ParserFunctions/ParserFunctions.php
@@ -69,6 +69,10 @@
7070
7171 $wgHooks['ParserFirstCallInit'][] = 'wfRegisterParserFunctions';
7272
 73+/**
 74+ * @param $parser Parser
 75+ * @return bool
 76+ */
7377 function wfRegisterParserFunctions( $parser ) {
7478 global $wgPFEnableStringFunctions, $wgPFEnableConvert;
7579

Status & tagging log