r84652 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84651‎ | r84652 | r84653 >
Date:00:41, 24 March 2011
Author:reedy
Status:deferred (Comments)
Tags:
Comment:
using "global $IP" in the global scope isn't going to do anything

Remove some unused globals elsewhere, comment out some others
Modified paths:
  • /trunk/extensions/FirefoggChunkedUpload/tests/UploadFromChunksTest.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/specials/MV_SpecialMVAdmin.php (modified) (history)
  • /trunk/extensions/MwEmbedSupport/MwEmbedResourceManager.php (modified) (history)
  • /trunk/extensions/News/NewsRenderer.php (modified) (history)
  • /trunk/extensions/OAI/OAIRepo_body.php (modified) (history)
  • /trunk/extensions/ParserWiki/ParserEngine.php (modified) (history)
  • /trunk/extensions/RDFIO/stores/SMW_ARC2Store.php (modified) (history)
  • /trunk/extensions/SemanticNotifyMe/includes/jobs/SMW_NMRefreshJob.php (modified) (history)
  • /trunk/extensions/SemanticNotifyMe/specials/SMWNotifyMe/SMWNotifyMe.php (modified) (history)
  • /trunk/extensions/SiteMatrix/SiteMatrix_body.php (modified) (history)
  • /trunk/extensions/SocialProfile/SystemGifts/SystemGifts.php (modified) (history)
  • /trunk/extensions/skins/Daddio/Daddio.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/SystemGifts/SystemGifts.php
@@ -1,8 +1,5 @@
22 <?php
33
4 -global $IP, $wgScriptPath, $wgAutoloadClasses, $wgAvailableRights, $wgGroupPermissions,
5 - $wgSpecialPages, $wgExtenstionMessagesFiles;
6 -
74 $wgAvailableRights[] = 'awardsmanage';
85 $wgGroupPermissions['staff']['awardsmanage'] = true;
96 $wgGroupPermissions['sysop']['awardsmanage'] = true;
Index: trunk/extensions/OAI/OAIRepo_body.php
@@ -3,7 +3,6 @@
44 die();
55 }
66
7 -global $IP;
87 require_once( "$IP/extensions/OAI/OAIFunctions.php" );
98 require_once( "$IP/includes/Export.php" );
109
Index: trunk/extensions/FirefoggChunkedUpload/tests/UploadFromChunksTest.php
@@ -1,6 +1,5 @@
22 <?php
33
4 -global $IP;
54 require_once( "$IP/maintenance/tests/ApiSetup.php" );
65 require_once( "$IP/maintenance/deleteArchivedFiles.inc" );
76 require_once( "$IP/maintenance/deleteArchivedRevisions.inc" );
Index: trunk/extensions/SemanticNotifyMe/specials/SMWNotifyMe/SMWNotifyMe.php
@@ -5,9 +5,6 @@
66
77 if ( !defined( 'MEDIAWIKI' ) ) die();
88
9 -
10 -
11 -global $IP;
129 require_once( $IP . "/includes/SpecialPage.php" );
1310
1411 /*
Index: trunk/extensions/SemanticNotifyMe/includes/jobs/SMW_NMRefreshJob.php
@@ -6,7 +6,7 @@
77 if ( !defined( 'MEDIAWIKI' ) ) {
88 die( "This file is part of the Semantic NotifyMe Extension. It is not a valid entry point.\n" );
99 }
10 -global $IP;
 10+
1111 require_once( "$IP/includes/JobQueue.php" );
1212
1313 class SMWNMRefreshJob extends Job {
Index: trunk/extensions/ParserWiki/ParserEngine.php
@@ -15,7 +15,6 @@
1616 }
1717
1818 function parse($grammarName, &$text) {
19 - global $IP;
2019 wfDebugLog("ParseEngine", "==========Start Parse Engine==========\n");
2120 $grammar = isset($this->mGrammars[$grammarName]) ? $this->mGrammars[$grammarName] : NULL;
2221 if ($grammar == NULL) {
Index: trunk/extensions/SiteMatrix/SiteMatrix_body.php
@@ -6,7 +6,6 @@
77 }
88
99
10 -global $IP;
1110 require_once( $IP.'/languages/Names.php' );
1211
1312 class SiteMatrix {
Index: trunk/extensions/MwEmbedSupport/MwEmbedResourceManager.php
@@ -18,7 +18,7 @@
1919 * Adds modules to ResourceLoader
2020 */
2121 public static function register( $mwEmbedResourcePath ) {
22 - global $IP, $wgExtensionMessagesFiles, $wgExtensionAssetsPath;
 22+ global $IP, $wgExtensionMessagesFiles;
2323 $localResourcePath = $IP .'/' . $mwEmbedResourcePath;
2424 // Get the module name from the end of the path:
2525 $modulePathParts = explode( '/', $mwEmbedResourcePath );
Index: trunk/extensions/RDFIO/stores/SMW_ARC2Store.php
@@ -4,8 +4,6 @@
55 die( 'Not a valid entry point.' );
66 }
77
8 -global $IP;
9 -
108 require_once( "$IP/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php" );
119
1210 /**
Index: trunk/extensions/News/NewsRenderer.php
@@ -17,11 +17,6 @@
1818 define('NEWS_HEAD_LENGTH', 1024 * 2);
1919 define('NEWS_HEAD_SCAN', 256);
2020
21 -#no need to include, rely on autoloader
22 -#global $IP;
23 -#require_once( "$IP/includes/RecentChange.php" );
24 -#require_once( "$IP/includes/ChangeList.php" );
25 -
2621 class NewsRenderer {
2722 var $parser;
2823 var $skin;
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialMVAdmin.php
@@ -35,14 +35,14 @@
3636 }
3737
3838 public function execute( $par ) {
39 - global $IP, $mvgIP;
 39+ //global $IP, $mvgIP;
4040 // require_once($IP . '/includes/SpecialPage.php' );
4141 // require_once($IP . '/includes/Title.php' );
4242
4343 global $wgOut, $wgRequest;
44 - global $wgServer; // "http://www.yourserver.org"
 44+ //global $wgServer; // "http://www.yourserver.org"
4545 // (should be equal to 'http://'.$_SERVER['SERVER_NAME'])
46 - global $wgScript; // "/subdirectory/of/wiki/index.php"
 46+ //global $wgScript; // "/subdirectory/of/wiki/index.php"
4747 global $wgUser;
4848
4949 if ( ! $wgUser->isAllowed( 'delete' ) ) {
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php
@@ -20,7 +20,6 @@
2121 */
2222 if ( !defined( 'MEDIAWIKI' ) ) die();
2323
24 -global $IP, $smwgIP;
2524 // all the special pages handled by this master Special Export (could reactor into individual classes if we want to)
2625 class MvVideoFeed extends SpecialPage {
2726 function __construct() {
Index: trunk/extensions/skins/Daddio/Daddio.class.php
@@ -8,7 +8,6 @@
99 if( !defined( 'MEDIAWIKI' ) )
1010 die( -1 );
1111
12 -global $IP;
1312 // @todo Fixme: autoload ModernTemplate
1413 require_once( "$IP/skins/Modern.php" );
1514

Follow-up revisions

RevisionCommit summaryAuthorDate
r84715Followup r84652, add back $IP for SiteMatrixreedy21:49, 24 March 2011
r84716Partial revert to r84652...reedy22:00, 24 March 2011

Comments

#Comment by Jack Phoenix (talk | contribs)   01:05, 24 March 2011
Index: trunk/extensions/SocialProfile/SystemGifts/SystemGifts.php
===================================================================
--- trunk/extensions/SocialProfile/SystemGifts/SystemGifts.php	(revision 84651)
+++ trunk/extensions/SocialProfile/SystemGifts/SystemGifts.php	(revision 84652)
@@ -1,8 +1,5 @@
 <?php
 
-global $IP, $wgScriptPath, $wgAutoloadClasses, $wgAvailableRights, $wgGroupPermissions,
-	$wgSpecialPages, $wgExtenstionMessagesFiles;
-

Mark wrote on Special:Code/MediaWiki/77272#c11321 that those were needed to shut up some notices about undefined variables. The lack of those globals never caused any notices for me though, but it's possible that my error_reporting settings were messed up.

#Comment by Reedy (talk | contribs)   21:50, 24 March 2011

I don't really get why it'd be needed. But then I've seen SiteMatrix bitching, and I reverted that in r84715....

#Comment by Reedy (talk | contribs)   21:52, 24 March 2011

Unless it only directly works on stuff included in LocalSettings, and stuff AutoLoaded in later has the problem?

Status & tagging log