r96752 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96751‎ | r96752 | r96753 >
Date:22:24, 10 September 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Kill unused globals/variables

Add to documentation
Modified paths:
  • /trunk/extensions/Translate/FFS.php (modified) (history)
  • /trunk/extensions/Translate/MessageGroups.php (modified) (history)
  • /trunk/extensions/Translate/scripts/magic-export.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialLanguageStats.php (modified) (history)
  • /trunk/extensions/Translate/tag/PageTranslationHooks.php (modified) (history)
  • /trunk/extensions/Translate/tag/SpecialPageTranslationDeletePage.php (modified) (history)
  • /trunk/extensions/Translate/tag/SpecialPageTranslationMovePage.php (modified) (history)
  • /trunk/extensions/Translate/tests/MessageGroupBaseTest.php (modified) (history)
  • /trunk/extensions/Translate/utils/CompatibilityCode.php (modified) (history)
  • /trunk/extensions/Translate/utils/ToolBox.php (modified) (history)
  • /trunk/extensions/Translate/utils/TranslateYaml.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/scripts/magic-export.php
@@ -80,7 +80,7 @@
8181
8282 global $wgTranslateExtensionDirectory;
8383 $inFile = "$wgTranslateExtensionDirectory/$filename";
84 - $dir = dirname( $inFile );
 84+
8585 if ( !file_exists( $inFile ) ) {
8686 continue;
8787 }
Index: trunk/extensions/Translate/tests/MessageGroupBaseTest.php
@@ -57,7 +57,6 @@
5858 public function testGetNamespaceNumber() {
5959 $conf = $this->groupConfiguration;
6060 $conf['BASIC']['namespace'] = NS_MEDIAWIKI;
61 - $group = MessageGroupBase::factory( $conf );
6261
6362 $this->assertEquals(
6463 NS_MEDIAWIKI,
@@ -69,7 +68,6 @@
7069 public function testGetNamespaceString() {
7170 $conf = $this->groupConfiguration;
7271 $conf['BASIC']['namespace'] = 'mediawiki';
73 - $group = MessageGroupBase::factory( $conf );
7472
7573 $this->assertEquals(
7674 NS_MEDIAWIKI,
@@ -85,7 +83,6 @@
8684 public function testGetNamespaceInvalid() {
8785 $conf = $this->groupConfiguration;
8886 $conf['BASIC']['namespace'] = 'ergweofijwef';
89 - $group = MessageGroupBase::factory( $conf );
9087 }
9188
9289 }
Index: trunk/extensions/Translate/FFS.php
@@ -729,7 +729,7 @@
730730
731731 $messages = $this->flatten( $messages );
732732 $messages = $this->group->getMangler()->mangle( $messages );
733 - foreach ( $messages as $key => &$value ) {
 733+ foreach ( $messages as &$value ) {
734734 $value = rtrim( $value, "\n" );
735735 }
736736
Index: trunk/extensions/Translate/MessageGroups.php
@@ -429,8 +429,6 @@
430430 protected function setDescriptionMsgReal( $key, $url ) {
431431 $this->description = '';
432432
433 - global $wgLang;
434 -
435433 $desc = null;
436434
437435 if ( !wfEmptyMsg( $key ) ) {
Index: trunk/extensions/Translate/tag/SpecialPageTranslationDeletePage.php
@@ -154,7 +154,6 @@
155155
156156 $wgOut->addWikiMsg( 'pt-deletepage-intro' );
157157
158 - $br = Html::element( 'br' );
159158 $subaction = array( 'name' => 'subaction' );
160159 $formParams = array( 'method' => 'post', 'action' => $this->getTitle( $this->text )->getLocalURL() );
161160
@@ -195,7 +194,6 @@
196195
197196 $wgOut->addWikiMsg( 'pt-deletepage-intro' );
198197
199 - $base = $this->title->getPrefixedText();
200198 $target = $this->title;
201199 $count = 1; // Base page
202200
Index: trunk/extensions/Translate/tag/PageTranslationHooks.php
@@ -584,7 +584,7 @@
585585 }
586586
587587 public static function replaceSubtitle( &$subpages, $skin = null , $out = null ) {
588 - global $wgOut, $wgUser;
 588+ global $wgOut;
589589 // $out was only added in some MW version
590590 if ( $out === null ) $out = $wgOut;
591591 $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
Index: trunk/extensions/Translate/tag/SpecialPageTranslationMovePage.php
@@ -91,9 +91,7 @@
9292 $this->page = $page;
9393
9494 $wgOut->setPagetitle( wfMsg( 'pt-movepage-title', $this->oldText ) );
95 - $link = $this->user->getSkin()->link( $this->oldTitle );
9695
97 -
9896 if ( !$this->user->isAllowed( 'pagetranslation' ) ) {
9997 $wgOut->permissionRequired( 'pagetranslation' );
10098 return;
Index: trunk/extensions/Translate/utils/CompatibilityCode.php
@@ -21,6 +21,8 @@
2222 * which evaluates to a function object which is called.
2323 * @param $args Array of arguments to pass to the function.
2424 * @since 1.17
 25+ *
 26+ * @return string
2527 */
2628 public static function encodeJsCall( $name, $args ) {
2729 $realFunction = array( 'Xml', 'encodeJsCall' );
Index: trunk/extensions/Translate/utils/TranslateYaml.php
@@ -74,7 +74,7 @@
7575 }
7676
7777 public static function fixSyckBooleans( &$yaml ) {
78 - foreach ( $yaml as $key => &$value ) {
 78+ foreach ( $yaml as &$value ) {
7979 if ( is_array( $value ) ) {
8080 self::fixSyckBooleans( $value );
8181 } elseif ( $value === 'yes' ) {
Index: trunk/extensions/Translate/utils/ToolBox.php
@@ -17,6 +17,10 @@
1818 * Adds link in toolbox to Special:Prefixindex to show all other
1919 * available translations for a message. Only shown when it
2020 * actually is a translatable/translated message.
 21+ *
 22+ * @param $skin Skin
 23+ *
 24+ * @return bool
2125 */
2226 static function toolboxAllTranslations( &$skin ) {
2327 global $wgTranslateMessageNamespaces;
Index: trunk/extensions/Translate/specials/SpecialLanguageStats.php
@@ -286,8 +286,6 @@
287287 }
288288
289289 protected function makeGroupRow( $group, $cache, $parent = false ) {
290 - global $wgLang;
291 -
292290 $out = '';
293291 $code = $this->code;
294292 $suppressComplete = $this->suppressComplete;
@@ -422,7 +420,6 @@
423421 }
424422
425423 protected function makeGroupLink( $group, $code, $params ) {
426 - global $wgOut;
427424
428425 $queryParameters = $params + array(
429426 'group' => $group->getId(),

Sign-offs

UserFlagDate
Krinkleinspected22:35, 10 September 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r96776Ping r96752. Fix two already broken tests and one that was broken in that rev...nikerabbit09:46, 11 September 2011

Comments

#Comment by Nikerabbit (talk | contribs)   07:36, 11 September 2011

The changes in MessageGroupBaseTest are wrong. You are hiding few bugs and the last test excepts an exception from the line you removed.

Status & tagging log