r86800 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86799‎ | r86800 | r86801 >
Date:21:40, 23 April 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Tidy up some unused variables and such
Modified paths:
  • /trunk/phase3/includes/FileDeleteForm.php (modified) (history)
  • /trunk/phase3/includes/Import.php (modified) (history)
  • /trunk/phase3/includes/UserMailer.php (modified) (history)
  • /trunk/phase3/includes/ZipDirectoryReader.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)
  • /trunk/phase3/includes/installer/MysqlInstaller.php (modified) (history)
  • /trunk/phase3/includes/parser/LinkHolderArray.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUploadStash.php (modified) (history)
  • /trunk/phase3/languages/classes/LanguageTyv.php (modified) (history)
  • /trunk/phase3/maintenance/importUseModWikipedia.php (modified) (history)
  • /trunk/phase3/maintenance/populateCategory.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/FormOptionsInitializationTest.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/TitlePermissionTest.php (modified) (history)
  • /trunk/phase3/tests/phpunit/phpunit.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/populateCategory.php
@@ -81,7 +81,6 @@
8282 }
8383 }
8484
85 - $maxlag = intval( $maxlag );
8685 $throttle = intval( $throttle );
8786 if ( $begin !== '' ) {
8887 $where = 'cl_to > ' . $dbw->addQuotes( $begin );
Index: trunk/phase3/maintenance/importUseModWikipedia.php
@@ -480,7 +480,6 @@
481481
482482 function resolveFailedDiff( $origText, $diff ) {
483483 $context = array();
484 - $rxRange = '\d+(?:,(\d+))?';
485484 $diffLines = explode( "\n", $diff );
486485 for ( $i = 0; $i < count( $diffLines ); $i++ ) {
487486 $diffLine = $diffLines[$i];
@@ -525,10 +524,10 @@
526525 $removedLinks = array_diff( $sourceLinks, $destLinks );
527526
528527 // Match up the removed links with the new links
529 - foreach ( $newLinks as $j => $newLink ) {
 528+ foreach ( $newLinks as $newLink ) {
530529 $minDistance = 100000000;
531530 $bestRemovedLink = false;
532 - foreach ( $removedLinks as $k => $removedLink ) {
 531+ foreach ( $removedLinks as $removedLink ) {
533532 $editDistance = levenshtein( $newLink, $removedLink );
534533 if ( $editDistance < $minDistance ) {
535534 $minDistance = $editDistance;
Index: trunk/phase3/tests/phpunit/includes/FormOptionsInitializationTest.php
@@ -14,7 +14,9 @@
1515 * array is correctly set through the FormOptions::add() function.
1616 */
1717 class FormOptionsExposed extends FormOptions {
18 - public $options;
 18+ public function getOptions() {
 19+ return $this->options;
 20+ }
1921 }
2022
2123 /**
@@ -54,7 +56,7 @@
5557 'value' => null,
5658 )
5759 ),
58 - $this->object->options
 60+ $this->object->getOptions()
5961 );
6062 }
6163
@@ -76,7 +78,7 @@
7779 'type' => FormOptions::INT,
7880 )
7981 ),
80 - $this->object->options
 82+ $this->object->getOptions
8183 );
8284 }
8385
Index: trunk/phase3/tests/phpunit/includes/TitlePermissionTest.php
@@ -331,7 +331,6 @@
332332 $this->setUser( $this->userName );
333333 global $wgUser, $wgContLang;
334334 $wgUser = $this->user;
335 - $prefix = $wgContLang->getFormattedNsText( NS_PROJECT );
336335
337336 $this->setTitle( NS_SPECIAL );
338337
Index: trunk/phase3/tests/phpunit/phpunit.php
@@ -19,7 +19,7 @@
2020
2121 class PHPUnitMaintClass extends Maintenance {
2222 public function finalSetup() {
23 - $settings = parent::finalSetup();
 23+ parent::finalSetup();
2424
2525 global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgUseDatabaseMessages;
2626
Index: trunk/phase3/includes/parser/LinkHolderArray.php
@@ -35,15 +35,15 @@
3636 * Compact the titles, only serialize the text form.
3737 */
3838 function __sleep() {
39 - foreach ( $this->internals as $ns => &$nsLinks ) {
40 - foreach ( $nsLinks as $key => &$entry ) {
 39+ foreach ( $this->internals as &$nsLinks ) {
 40+ foreach ( $nsLinks as &$entry ) {
4141 unset( $entry['title'] );
4242 }
4343 }
4444 unset( $nsLinks );
4545 unset( $entry );
4646
47 - foreach ( $this->interwikis as $key => &$entry ) {
 47+ foreach ( $this->interwikis as &$entry ) {
4848 unset( $entry['title'] );
4949 }
5050 unset( $entry );
@@ -55,8 +55,8 @@
5656 * Recreate the Title objects
5757 */
5858 function __wakeup() {
59 - foreach ( $this->internals as $ns => &$nsLinks ) {
60 - foreach ( $nsLinks as $key => &$entry ) {
 59+ foreach ( $this->internals as &$nsLinks ) {
 60+ foreach ( $nsLinks as &$entry ) {
6161 $entry['title'] = Title::newFromText( $entry['pdbk'] );
6262 }
6363 }
@@ -259,7 +259,6 @@
260260
261261 wfProfileIn( __METHOD__.'-check' );
262262 $dbr = wfGetDB( DB_SLAVE );
263 - $page = $dbr->tableName( 'page' );
264263 $threshold = $this->parent->getOptions()->getStubThreshold();
265264
266265 # Sort by namespace
@@ -268,8 +267,6 @@
269268 $linkcolour_ids = array();
270269
271270 # Generate query
272 - $query = false;
273 - $current = null;
274271 $queries = array();
275272 foreach ( $this->internals as $ns => $entries ) {
276273 foreach ( $entries as $entry ) {
Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -1097,7 +1097,7 @@
10981098 }
10991099
11001100 public function removeIdentifierQuotes( $s ) {
1101 - return strpos($s, '/*Q*/') === FALSE ? $s : substr($s, 5); ;
 1101+ return strpos($s, '/*Q*/') === FALSE ? $s : substr($s, 5);
11021102 }
11031103
11041104 public function isQuotedIdentifier( $s ) {
Index: trunk/phase3/includes/UserMailer.php
@@ -127,7 +127,6 @@
128128 }
129129
130130 if ( is_array( $wgSMTP ) ) {
131 - $found = false;
132131 if ( function_exists( 'stream_resolve_include_path' ) ) {
133132 $found = stream_resolve_include_path( 'Mail.php' );
134133 } else {
Index: trunk/phase3/includes/installer/MysqlInstaller.php
@@ -494,7 +494,6 @@
495495 }
496496
497497 // Try to grant to all the users we know exist or we were able to create
498 - $escPass = $this->db->addQuotes( $password );
499498 $dbAllTables = $this->db->addIdentifierQuotes( $dbName ) . '.*';
500499 foreach( $grantableNames as $name ) {
501500 try {
Index: trunk/phase3/includes/FileDeleteForm.php
@@ -118,7 +118,6 @@
119119 } else {
120120 $id = $title->getArticleID( Title::GAID_FOR_UPDATE );
121121 $article = new Article( $title );
122 - $error = '';
123122 $dbw = wfGetDB( DB_MASTER );
124123 try {
125124 // delete the associated article first
Index: trunk/phase3/includes/ZipDirectoryReader.php
@@ -542,7 +542,7 @@
543543 */
544544 function getStructSize( $struct ) {
545545 $size = 0;
546 - foreach ( $struct as $key => $type ) {
 546+ foreach ( $struct as $type ) {
547547 if ( is_array( $type ) ) {
548548 list( $typeName, $fieldSize ) = $type;
549549 $size += $fieldSize;
Index: trunk/phase3/includes/specials/SpecialUploadStash.php
@@ -320,7 +320,6 @@
321321 $this->setHeaders();
322322 $this->outputHeader();
323323
324 -
325324 // create the form, which will also be used to execute a callback to process incoming form data
326325 // this design is extremely dubious, but supposedly HTMLForm is our standard now?
327326
Index: trunk/phase3/includes/Import.php
@@ -907,6 +907,9 @@
908908 $this->params = $params;
909909 }
910910
 911+ /**
 912+ * @return Title
 913+ */
911914 function getTitle() {
912915 return $this->title;
913916 }
Index: trunk/phase3/languages/classes/LanguageTyv.php
@@ -28,7 +28,7 @@
2929 $roundFrontVowels = array( "ө", "ү", "ö", "ü" );
3030 $unroundBackVowels = array( "а", "ы", "я", "a", "y" );
3131 $roundBackVowels = array( "ё", "о", "у", "ю", "o", "u" );
32 - $voicedPhonemes = array( "д", "б", "з", "ж", "г", "d", "b", "z", "g" );
 32+ //$voicedPhonemes = array( "д", "б", "з", "ж", "г", "d", "b", "z", "g" );
3333 $unvoicedPhonemes = array( "т", "п", "с", "ш", "к", "ч", "х", "t", "p", "s", "k", "x" );
3434 $directiveUnvoicedStems = array( "т", "п", "с", "ш", "к", "ч", "х", "л", "м", "н", "ң", "t", "p", "s", "k", "x", "l", "m", "n", "ŋ" );
3535 $directiveVoicedStems = array( "д", "б", "з", "ж", "г", "р", "й", "d", "b", "z", "g", "r", "j" );

Follow-up revisions

RevisionCommit summaryAuthorDate
r87127Followup r86800, add missing ()reedy17:51, 29 April 2011

Comments

#Comment by Platonides (talk | contribs)   17:13, 29 April 2011
tests/phpunit/includes/FormOptionsInitializationTest.php
-$this->object->options
+$this->object->getOptions

1) FormOptionsInitializationTest::testAddIntegers

Undefined property: FormOptionsExposed::$getOptions

Status & tagging log