Page MenuHomePhabricator

Reduce use of global and public variables
Open, LowPublic


Author: sacolcor

This bug is intended to track background code-cleanup work aimed at reducing the use of global and public variables in the MediaWiki code base. The use of such variables is discouraged in software engineering, because as the software grows it becomes increasingly hard to ensure that they remain in a consistent state. It also makes the code more difficult to modularize, because different modules become dependent on each others' internal implementation details, instead of on clearly defined interfaces.

The most common practice to reduce these difficulties is to wrap the variables in get/set functions. Many of these functions are already present in the MW code base, but are not being used consistently. Progress on this bug will primarily consist of ensuring that access to the variables is properly routed through these functions, introducing new functions where they do not exist, and making the variables 'private' where possible, to ensure that that the accessors are not bypassed in the future.



Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:38 PM
bzimport set Reference to bz9968.
bzimport added a subscriber: Unknown Object (MLST).

Blocks the tracking bug 700 (Code quality issues)

sacolcor wrote:

Encapsulate wgCanonicalNamespaceNames

My first patch; suggestions for improvement welcome.

attachment bug9968-1.diff ignored as obsolete

sacolcor wrote:

Comment on attachment 3654
Encapsulate wgCanonicalNamespaceNames

Attachment moved to child bug.

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

Krinkle set Security to None.
Krinkle removed a subscriber: Unknown Object (MLST).
Phabricator_maintenance renamed this task from Reduce use of global and public variables (tracking) to Reduce use of global and public variables.Aug 13 2016, 11:30 PM
Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:01 AM
Tacsipacsi changed the subtype of this task from "Feature Request" to "Task".
Tacsipacsi subscribed.

This is an improvement to the developer experience, not the user experience. So it may belong to a broad sense of “Severity: enhancement”, but not even a broad sense of “Subtype: Feature”.