r69894 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69893‎ | r69894 | r69895 >
Date:19:32, 25 July 2010
Author:reedy
Status:deferred (Comments)
Tags:
Comment:
Fix some more unused stuff
Modified paths:
  • /trunk/extensions/Translate/MessageGroups.php (modified) (history)
  • /trunk/extensions/Translate/SpecialTranslationStats.php (modified) (history)
  • /trunk/extensions/Translate/TranslatePage.php (modified) (history)
  • /trunk/extensions/Translate/ffs/Gettext.php (modified) (history)
  • /trunk/extensions/Translate/ffs/Java.php (modified) (history)
  • /trunk/extensions/Translate/ffs/OpenLayers.php (modified) (history)
  • /trunk/extensions/Translate/ffs/PhpVariables.php (modified) (history)
  • /trunk/extensions/Translate/ffs/Simple.php (modified) (history)
  • /trunk/extensions/Translate/ffs/Wiki.php (modified) (history)
  • /trunk/extensions/Translate/ffs/WikiExtension.php (modified) (history)
  • /trunk/extensions/Translate/tag/SpecialPageTranslation.php (modified) (history)
  • /trunk/extensions/Translate/tag/SpecialPageTranslationMovePage.php (modified) (history)
  • /trunk/extensions/Translate/utils/TranslationHelpers.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/TranslatePage.php
@@ -193,10 +193,10 @@
194194 protected function settingsForm( $errors ) {
195195 global $wgScript;
196196
197 - $task = $this->taskSelector();
198 - $group = $this->groupSelector();
199 - $language = $this->languageSelector();
200 - $limit = $this->limitSelector();
 197+ //$task = $this->taskSelector();
 198+ //$group = $this->groupSelector();
 199+ //$language = $this->languageSelector();
 200+ //$limit = $this->limitSelector();
201201 $button = Xml::submitButton( wfMsg( TranslateUtils::MSG . 'submit' ) );
202202
203203 $options = array();
Index: trunk/extensions/Translate/SpecialTranslationStats.php
@@ -148,8 +148,6 @@
149149 }
150150
151151 protected function eRadio( $name, FormOptions $opts, array $alts ) {
152 - $value = $opts[$name];
153 -
154152 $label = 'translate-statsf-' . $name;
155153 $label = wfMsgExt( $label, array( 'parsemag', 'escapenoentities' ) );
156154 $s = '<tr><td>' . $label . '</td><td>';
@@ -525,7 +523,6 @@
526524 if ( !$this->groups && !$this->codes ) return 'all';
527525
528526 // The key-building needs to be in sync with ::labels()
529 - $keys = array();
530527
531528 list( $key, $code ) = TranslateUtils::figureMessage( $row->rc_title );
532529
Index: trunk/extensions/Translate/MessageGroups.php
@@ -550,7 +550,6 @@
551551 }
552552
553553 $lines = array_map( 'trim', explode( "\n", $data ) );
554 - $array = array();
555554 foreach ( $lines as $line ) {
556555 if ( $line === '' || $line[0] === '#' || $line[0] === '<' ) {
557556 continue;
@@ -725,8 +724,6 @@
726725 public function getMessage( $key, $code ) {
727726 global $wgContLang;
728727
729 - $params = array();
730 -
731728 if ( $code && $wgContLang->getCode() !== $code ) {
732729 return TranslateUtils::getMessageContent( $key, $code );
733730 } else {
Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php
@@ -486,7 +486,7 @@
487487
488488 $dbw = wfGetDB( DB_MASTER );
489489 $dbw->delete( 'translate_sections', array( 'trs_page' => $page->getTitle()->getArticleId() ), __METHOD__ );
490 - $ok = $dbw->insert( 'translate_sections', $inserts, __METHOD__ );
 490+ $dbw->insert( 'translate_sections', $inserts, __METHOD__ );
491491
492492 /* Stores the names of changed sections in the database.
493493 * Used for calculating completion percentages for outdated messages */
Index: trunk/extensions/Translate/tag/SpecialPageTranslationMovePage.php
@@ -294,7 +294,6 @@
295295
296296 protected function performAction() {
297297 $jobs = array();
298 - $titles = array();
299298
300299 $target = $this->newTitle;
301300 $base = $this->oldTitle->getPrefixedText();
Index: trunk/extensions/Translate/utils/TranslationHelpers.php
@@ -685,7 +685,6 @@
686686 }
687687
688688 // Shortcuts
689 - $code = $this->targetLanguage;
690689 $key = $this->page;
691690
692691 $definitionTitle = Title::makeTitleSafe( $this->title->getNamespace(), "$key/en" );
Index: trunk/extensions/Translate/ffs/Simple.php
@@ -161,7 +161,6 @@
162162 $code = $collection->code; // shorthand
163163
164164 // Open temporary stream
165 - $filename = $this->group->getMessageFile( $code );
166165 $handle = fopen( 'php://temp', 'wt' );
167166
168167 $this->addAuthors( $collection->getAuthors(), $code );
Index: trunk/extensions/Translate/ffs/PhpVariables.php
@@ -32,7 +32,7 @@
3333
3434 $contents = file_get_contents( $this->filename );
3535 $m = array();
36 - $count = preg_match_all( '/@author (.*)/', $contents, $m );
 36+ preg_match_all( '/@author (.*)/', $contents, $m );
3737
3838 return $m[1];
3939 }
Index: trunk/extensions/Translate/ffs/WikiExtension.php
@@ -108,7 +108,6 @@
109109 $code = $collection->code; // shorthand
110110
111111 // Open temporary stream
112 - $filename = $this->group->getMessageFile( $code );
113112 $handle = fopen( 'php://temp', 'wt' );
114113
115114 $this->addAuthors( $collection->getAuthors(), $code );
@@ -176,7 +175,7 @@
177176 }
178177
179178 public function parseAuthorsFromString( $string ) {
180 - $count = preg_match_all( '/@author (.*)/', $string, $m );
 179+ preg_match_all( '/@author (.*)/', $string, $m );
181180
182181 return $m[1];
183182 }
Index: trunk/extensions/Translate/ffs/Java.php
@@ -108,7 +108,6 @@
109109
110110 list( $name, $native ) = $this->getLanguageNames( $code );
111111 $authors = $this->formatAuthors( '# Author: ', $code );
112 - $when = wfTimestamp( TS_ISO_8601 );
113112
114113 fwrite( $handle, <<<HEADER
115114 # Messages for $name ($native)
Index: trunk/extensions/Translate/ffs/OpenLayers.php
@@ -157,7 +157,6 @@
158158 // Get and write messages.
159159 $lines = '';
160160 foreach ( $collection as $message ) {
161 - $key = Xml::escapeJsString( $message->key() );
162161 $value = Xml::escapeJsString( $message->translation() );
163162 if( $this->keyquote ) {
164163 $lines .= " '{$message->key()}': \"{$value}\",\n\n";
@@ -166,7 +165,6 @@
167166 }
168167 }
169168
170 -
171169 // Strip last comma.
172170 $lines = substr( $lines, 0, -3 );
173171 $lines .= "\n\n";
Index: trunk/extensions/Translate/ffs/Wiki.php
@@ -24,7 +24,7 @@
2525 }
2626 $contents = file_get_contents( $this->filename );
2727 $m = array();
28 - $count = preg_match_all( '/@author (.*)/', $contents, $m );
 28+ preg_match_all( '/@author (.*)/', $contents, $m );
2929
3030 return $m[1];
3131 }
@@ -37,7 +37,7 @@
3838 $contents = file_get_contents( $this->filename );
3939
4040 /** FIXME: handle the case where the first comment is missing */
41 - $dollarstart = strpos( $contents, '$' );
 41+ //$dollarstart = strpos( $contents, '$' );
4242
4343 $start = strpos( $contents, '*/' );
4444 $end = strpos( $contents, '$messages' );
Index: trunk/extensions/Translate/ffs/Gettext.php
@@ -319,7 +319,7 @@
320320 // READ
321321 //
322322 public function readFromVariable( $data ) {
323 - $authors = $messages = array();
 323+ $authors = array();
324324
325325 # Authors first
326326 $matches = array();

Follow-up revisions

RevisionCommit summaryAuthorDate
r69936Fixup per comments to r69894...reedy09:50, 26 July 2010

Comments

#Comment by Nikerabbit (talk | contribs)   09:43, 26 July 2010
+//$task = $this->taskSelector();

Are used, see the loop below.

-$key = Xml::escapeJsString( $message->key() );

This looks more like a bug than just unused variable.

#Comment by Reedy (talk | contribs)   09:47, 26 July 2010

I see for the first.

For the 2nd, I'm guessing

if( $this->keyquote ) {

				$lines .= "    '{$message->key()}': \"{$value}\",\n\n";

Should be {$key} ?

Status & tagging log