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

Reedy created this task.Jul 24 2016, 3:26 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 24 2016, 3:26 PM

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.

Reedy added a comment.EditedJul 26 2016, 12:15 AM

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?

Krinkle triaged this task as Low priority.Feb 17 2018, 3:28 AM
Krinkle removed a subscriber: Krinkle.Mar 16 2020, 9:17 PM