[16:25:26] MediaWiki SQL, how does it work? [16:25:58] For context, I'm working on https://phabricator.miraheze.org/T10522 [16:26:29] (though I currently only have made a boilerplate) [16:27:17] I don't like SQL, and tend to avoid whenever I can, but I'm not a complete noob in it, I know how to do it using raw mysqli. [16:28:50] But MediaWiki has its own abstraction layer, and I've just been staring at the docs (https://doc.wikimedia.org/mediawiki-core/master/php/classWikimedia_1_1Rdbms_1_1Database.html#aea5a6ff07383c5afdee586ba5f76103b), and I just have no idea what am looking at. [16:30:06] I'm looking at other extension's code as an example, and I'm sure I'll get it eventually, but idk if I prefer raw SQL or this. [16:30:14] \/rantoff [16:50:17] [discord] Just ask ChatGPT to code it for you [16:50:41] [discord] but in all seriousness, maybe look at the code that WikiDiscover uses for database operations, it may be helpful [17:37:50] WikiDiscover does not use modern SQL (SELECT methods at least). ImportDump is our only extension to use fully modern SELECT methods (using SelectQueryBuilder), but in reality for getting and setting categories, you can use the RemoteWiki class in CreateWiki rather than any additional SQL queries at all I believe. [17:40:55] Thank you Cosmic! [17:41:09] Yes, RemoteWiki has a function to set categories: https://github.com/miraheze/CreateWiki/blob/802d90a2a3d3d9a10201bad090e756bfb8f2b7ed/includes/RemoteWiki.php#L309 [17:41:39] No more reading documentation!!! [17:42:18] No problem, and yep, and after calling setCategory(), you also need to call commit() to commit the changes to the database, just FYI. [18:08:03] [discord] I would like to adapt this widget to MediaWiki, unfortunately the HTML cannot be modified directly, do you know how to adapt it (probably with JS)? [18:08:05] [discord] https://docs.widgetbot.io/embed/crate/tutorial/#getting-started [18:17:43] Tutorial says to add the JS to the tag, which you can't do without adding it via a hook on the server side (we can do that for you if you make a task at [[Phabricator]], or you can make a PR with that yourself if you know PHP at our config repository) [18:18:44] Once the widget is added to the server you can use JavaScript to make whatever modifications you want to make to the embed. [18:19:06] However, I doubt this will work on Miraheze because of the CSP [19:21:32] cdn.jsdelivr.net is allowed [19:22:42] allowed in CSP I mean [19:56:13] [discord] So if I understood correctly, I have to make a request on Phabricator with the link and the HTML that the bot gave me when I send `/crate`, and they will add the widget? [23:00:59] CosmicAlpha[m]: They could be only using jsdelivr to serve the JS, they script could try to make requests to another server for whatever that embed is for. [23:01:34] @Soronos: Yes [23:01:42] Oh, true.