[23:42:57] [1/25] ```php [23:42:57] [2/25] $wmgDisabledExtensionHooks = [ [23:42:58] [3/25] 'display_map' => 'the maps extension is globally disabled [[lmao]]', [23:42:58] [4/25] 'display_point' => 'this one 2', [23:42:58] [5/25] 'display_points' => 'this one 3', [23:42:58] [6/25] 'display_line' => 'this one 4', [23:42:59] [7/25] ]; [23:42:59] [8/25] function createFallbackParserFunction( $hook, $msg ) { [23:42:59] [9/25] return static function ( Parser $parser ) use ( $hook, $msg ) { [23:43:00] [10/25] MediaWiki\MediaWikiServices::getInstance()->getContentLanguage()->mMagicExtensions[$hook] = [ $hook, $hook ]; [23:43:00] [11/25] $parser->setFunctionHook( [23:43:01] [12/25] $hook, [23:43:01] [13/25] static function ( Parser $parser, PPFrame $frame, array $arguments ) use ( $hook, $msg ){ [23:43:02] [14/25] return [ $msg ]; [23:43:02] [15/25] }, [23:43:03] [16/25] Parser::SFH_OBJECT_ARGS [23:43:03] [17/25] ); [23:43:04] [18/25] }; [23:43:04] [19/25] } [23:43:05] [20/25] foreach ( $wmgDisabledExtensionHooks as $hook => $msg ) { [23:43:05] [21/25] $wgHooks['ParserFirstCallInit'][] = createFallbackParserFunction( $hook, $msg ); [23:43:06] [22/25] } [23:43:06] [23/25] ``` [23:43:07] [24/25] The greatest PHP code you've ever seen in your life [23:43:07] [25/25] I have absolutely no idea if this is using best practices or anything but it seems to work [23:50:24] is this meant to all be like in localsettings 😭 [23:50:57] putting lots of random functions in localsettings is the best thing to do to keep job security [23:51:00] as nobody knows what they do [23:57:46] [1/2] well this was to put a fallback hook that we could enable when we disable an extension, since a lot of people complained about wiki pages being broken when we disabled Maps [23:57:46] [2/2] afaik it's either you do localsettings or you make it its own extension. or ig maybe it could be put into an existing extension [23:58:20] mirahezemagic [23:58:24] yeah ig [23:58:25] that's literally the point of the extension [23:58:29] tbf [23:58:34] I shove all sorts of random functions into localsettings [23:58:45] the entire sentry profiler is in mw-config even though it should probably not be [23:59:11] well as you can probably tell I'm not a PHP expert [23:59:26] as you can probably tell I am not either [23:59:31] I know enough about php to be dangerous