Page MenuHomePhabricator

Allow extensions to register global variables and functions for use in LocalSettings.php
Closed, DeclinedPublic

Description

I'm trying to update the Extension:MobileDetect to extension registration. However, one of the features of this extension is that it introduces a global function called mobiledetect() that returns true if we're on a mobile device, and false otherwise. This allows admins to customize what extensions/configs/skins get loaded in LocalSettings.php, depending on the kind of device.

The problem is that the current extension registration system seems to lack a way to define global variables or functions early enough so they can be used in LocalSettings.php.

Event Timeline

Legoktm subscribed.

Sorry about the late response, but this is intentionally not supported. For the most part, the goal is that config settings should be static and not changing dynamically. With mobiledetect(), it looks really easy to cause cache pollution unless you're also varying all caches based on whether it's mobile or not. Stuff like that should really be implemented using responsive design, not user agent sniffing.