Last modified: 2013-10-23 18:33:50 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T49102, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 47102 - unspecified globals
unspecified globals
Status: RESOLVED INVALID
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-10 20:25 UTC by John McClure
Modified: 2013-10-23 18:33 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description John McClure 2013-04-10 20:25:00 UTC
Please declare all globals used or created in this extension. When this extension is included within a function rather than at file-scope, then globals are not being created/referenced correctly. 

Here's what I added to my version 1.8 SemanticMnediawiki.php to make it work in a wikifarm:

global $wgExtensionCredits, $wgExtensionFunctions, $wgHooks, $wgExtensionMessagesFiles, $wgAutoloadClasses, 
	$wgSpecialPageGroups, $wgSpecialPages, $wgGroupPermissions, $wgAvailableRights, $wgReservedUsernames,
	$wgResourceModules, $wgLogTypes, $wgLogNames, $wgLogHeaders, $wgLogActions, $wgAPIModules, $useJQuery, 
	$wgAPIListModules, $wgVersion, $wgExtraNamespaces, $wgNamespacesWithSubpages, $wgActions, $wgJobClasses, 
	$wgAjaxExportList, $wgEditPageFrameOptions, $wgLanguageCode, $wgParserTestFiles, $wgDefaultUserOptions,
	$wgExtensionAssetsPath, $wgExtensionAssetsFullPath, $useJQuery, $wgExtensionAliasesFiles
	;


Here is what I added to version 1.8 SMW_Settings.php:

global $smwgScriptPath, $smwgScriptUrl;
global $wgExtensionAssetsPath, $wgExtensionAssetsUrl;
global $smwgIP, $smwgDefaultStore, $smwgSparqlDatabase, $smwgSparqlQueryEndpoint,
	$smwgSparqlUpdateEndpoint, $smwgSparqlDataEndpoint, $smwgSparqlDefaultGraph,
	$smwgHistoricTypeNamespace, $smwgNamespaceIndex, $smwgShowFactbox,
	$smwgShowFactboxEdit, $smwgToolboxBrowseLink, $smwgInlineErrors, 
	$smwgUseCategoryHierarchy, $smwgCategoriesAsInstances, $smwgLinksInValues,
	$smwgDefaultNumRecurringEvents, $smwgMaxNumRecurringEvents, 
	$smwgBrowseShowInverse, $smwgBrowseShowAll, $smwgSearchByPropertyFuzzy,
	$smwgTypePagingLimit, $smwgConceptPagingLimit, $smwgPropertyPagingLimit,
	$smwgMaxPropertyValues, $smwgQEnabled, $smwgQMaxLimit, $smwgIgnoreQueryErrors,
	$smwgQSubcategoryDepth, $smwgQSubpropertyDepth, $smwgQEqualitySupport,
	$smwgQSortingSupport, $smwgQRandSortingSupport, $smwgQDefaultNamespaces,
	$smwgQComparators, $smwStrictComparators, $smwgQMaxSize, $smwgQMaxDepth,
	$smwgQDefaultLimit, $smwgQMaxInlineLimit, $smwgQPrintoutLimit, $smwgQDefaultLinking,
 	$smwgQConceptCaching, $smwgQConceptMaxSize, $smwgQConceptMaxDepth, 
	$smwgQConceptFeatures, $smwgQConceptCacheLifetime, $smwgResultFormats, 
	$smwgResultAliases, $smwgQuerySources, $smwgPDefaultType, $smwgRSSEnabled,
	$smwgRSSWithPages, $smwgAllowRecursiveExport, $smwgExportBacklinks,
	$smwgNamespace, $smwgMaxNonExpNumber, $smwgEnableUpdateJobs,
	$smwgNamespacesWithSemanticLinks, $smwgPageSpecialProperties, 
	$smwgDeclarationProperties, $smwgTranslate, $smwgRAPPath, 
	$smwgAdminRefreshStore, $smwgAutocompleteInSpecialAsk, $smwgAutoRefreshSubject, $smwgQFeatures
	; 

To 1.8 SMW_Resources.php I've added:
global $wgResourceModules;

There may be other places because I'm getting unexpected results from queries.
Comment 1 MWJames 2013-10-23 18:33:50 UTC
Issues with declarative GLOBALS are not evident in the available unit tests [0], [1]. 

[0] https://integration.wikimedia.org/ci/job/mwext-SemanticMediaWiki-testextensions-master/1311/console

[1] https://travis-ci.org/wikimedia/mediawiki-extensions-SemanticMediaWiki

PS: As for the current master, Settings are no longer used as GLOBALSand provided explicitly through an interface [0] an either used during injection or through the ContextResource [2]. For more for information about GLOBALS, see [3]. 

[0] https://github.com/wikimedia/mediawiki-extensions-SemanticMediaWiki/blob/master/includes/Settings.php

[1] https://github.com/wikimedia/mediawiki-extensions-SemanticMediaWiki/blob/master/includes/Setup.php#L117

[2] https://github.com/wikimedia/mediawiki-extensions-SemanticMediaWiki/blob/master/includes/context/BaseContext.php#L47

[3] http://php.net/manual/en/reserved.variables.globals.php

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links