[14:13:24] Amir1: Hm.. trying to install TitleKey on latest master fails in update.php: [14:13:38] Creating titlekey table...Wikimedia\Rdbms\DBQueryError from line 1203 of /Users/krinkle/Development/mediawiki/includes/libs/rdbms/database/Database.php: Error 1: near "binary": syntax error [14:13:38] Function: Wikimedia\Rdbms\Database::sourceFile( /Users/krinkle/Development/mediawiki/extensions/TitleKey/sql/titlekey.sql ) [14:13:38] Query: CREATE TABLE "titlekey" ( tk_page int unsigned NOT NULL PRIMARY KEY, tk_namespace int NOT NULL, tk_key varchar(255) binary NOT NULL [14:13:51] I'm guessing this is because we removed mysql>sqlite automation [14:40:00] stupid question: what’s the expected way for an extension to programatically register hooks? [14:40:05] https://www.mediawiki.org/wiki/Manual:Extension.json/Schema#ExtensionFunctions says that a callback should be used, but not how [14:40:31] and https://www.mediawiki.org/wiki/Manual:Extension.json/Schema#callback doesn’t explain this particular use case either, but it mentions that MediaWikiServices (and therefore the HookContainer service) aren’t available yet [14:40:43] should the callback just assign to $wgHooks, old school style? ^^ [14:41:51] oh! SettingsBuilder has a registerHookHandlers method? [14:41:57] I didn’t see that [14:42:01] that sounds just like what I want then [14:42:10] (SettingsBuilder is passed into the callback, apparently) [14:43:47] ugh, no, that throws a fatal error [14:43:48] “SettingsBuilder::load only supported while still in the loading stage” [14:43:49] :( [14:52:00] My assumption would be $wgHooks given how early an extension.json callback runs, but I don't have super high confidence that is accurate [14:52:43] Krinkle: yeah, that looks like it [15:56:13] Amir1: Hm.. I don't suppose we have automatic sql->json conversion? [15:56:31] nope, we have a script that helps [15:56:39] Is `varchar(255) binary` something we support in abstract or do we have to go change to varbinary while at it? [15:57:10] https://github.com/Ladsgroup/db-analyzor-tools/blob/master/db_abstractor.py [15:57:23] you have to go to varbinary [16:00:56] Hm.. so that means a one-off non-abstract schema change? [16:01:38] Or is there a (discouraged) way we can get it to output it via "type": "string" (VARCHAR) and set binary somewhere? I did try "collation" and "charset" but neither was allowed [18:58:03] Lucas_WMDE: CentralNotice does that: https://gerrit.wikimedia.org/g/mediawiki/extensions/CentralNotice/+/b6140a9994ae73f1304f01405560a425dc851aa0/includes/CentralNoticeHooks.php#54 [20:26:08] Lucas_WMDE: depending on the issue, I'd probably not bother with conditional hooks and instead make the function perform the relevant check. That also reduces setup cost slightly, by deferring the check. And makes the logic testable. [20:28:07] But yeah, onRegistration is a reasonable place to do it if you can make the decision at that point already (without calling into any unsafe code). [20:29:38] OAuth used to do it in ExtensionFunctions, so at some point that worked too. But it was removed before SettingsBuilder was created, not sure if that affected it.