Page MenuHomePhabricator

Support autoconfirmed constants in extension registration
Open, LowPublic

Description

TorBlock has an autopromote constant defined, but under extension registration, the only way this can be supported is using the callback

define( 'APCOND_TOR', 'tor' );

Need a way to support these. Not sure if php constants are wanted to be supported more generally... I'm sure @Legoktm will repurpose this bug as appropriate

Event Timeline

Global constants are something we can support if necessary, but I'd like to move away from them if possible. The main problem is that extension.json is processed later, so if the constants are needed in LocalSettings.php, it's too late.

Global constants are something we can support if necessary, but I'd like to move away from them if possible. The main problem is that extension.json is processed later, so if the constants are needed in LocalSettings.php, it's too late.

The patch looks a better long term fix... I'll have a look at putting some time into review/test of those

We could just use the string 'tor', or a class constant... It just feels a bit weird using the latter

I suspect APCOND_ just looks nice/obvious as to what it's about

I suspect, there are going to be very few cases where constants need to be global, and can't belong to a class

Global constants are something we can support if necessary, but I'd like to move away from them if possible. The main problem is that extension.json is processed later, so if the constants are needed in LocalSettings.php, it's too late. [..]

We could just use [..] a class constant... [..], and can't belong to a class

Hm.. Even if we make a class for it, we still can't autoload a class from an extension within LocalSettings.php, right?