[14:16:23] @originalauthority hey could I ask ya what a slot is plzhttps://phabricator.wikimedia.org/source/mediawiki/browse/REL1_41/maintenance/edit.php$68 [14:17:03] seems its needed for `$updater->setContent()` [14:26:22] They represent different parts of a revision/page, eg, one slot would be for the content, and one for documentation or something [14:26:37] I dont really understand how they work myself too much and I generally just always use the main slot [14:27:26] so def not needed for json [14:29:00] how do you specify the main slot? :ThinkerMH: [14:29:35] SlotRecord::Main [14:31:28] is that meant to be a call()? [14:34:00] I admire how you guys keep track of everything in such a giant codebase [14:38:36] oh wait cap I think its MAIN not Mian [14:47:11] oh yeah it will be MAIN [14:48:23] that if else took way to long to rewite I have python syntax in my head [14:48:44] aight [14:48:48] lets try this ig [14:48:52] [1/19] ```php [14:48:53] [2/19] function processCallback( $data ) { [14:48:53] [3/19] $actor = $this->getUser(); [14:48:53] [4/19] $title = Title::newFromText("Mediawiki:Themeing.json"); [14:48:54] [5/19] $page = $this->factory->newFromTitle( $title ); [14:48:54] [6/19] $updater = $page->newPageUpdater( $actor ); [14:48:54] [7/19] $content = ContentHandler::makeContent( json_encode($data), $title ); [14:48:55] [8/19] $updater->setContent( SlotRecord::MAIN, $content); [14:48:55] [9/19] $updater->saveRevision(CommentStoreComment::newUnsavedComment('Updating Themeing values per ' . $actor->getName()), ); [14:48:55] [10/19] $status = $updater->getStatus(); [14:48:55] [11/19] $notExploded = $status->isOK(); [14:48:56] [12/19] if (!$notExploded) { [14:48:56] [13/19] return "An error occured. No I don't know what bye."; [14:48:57] [14/19] } [14:48:57] [15/19] else { [14:48:58] [16/19] return "New Base Link Color:" . $data['baselinkcolor']; [14:48:58] [17/19] } [14:48:59] [18/19] } [14:48:59] [19/19] ``` [14:49:39] when my dev env wakes up :/ [14:52:05] its not waking up ;( [14:54:00] this is what i get for using mwcli [16:54:00] hm, is there a certain way to pass factories through __construct()? the way im doing it seems to crash [16:54:26] (for ref ```Original exception: [b351bf3b9b6974ba3ab4c084] /wiki/Special:Theming ArgumentCountError: Too few arguments to function MediaWiki\Extension\Themeing\SpecialTheming::__construct(), 0 passed in /var/www/html/w/vendor/wikimedia/object-factory/src/ObjectFactory.php on line 240 and exactly 1 expected``` [17:23:23] Your constructor looks wrong [17:23:49] [Clownge](https://cdn.discordapp.com/emojis/1040588428535922779.webp?size=48&quality=lossless&name=Clownge) [17:24:08] You generally want ti pass a factory in from MediaWiki into the constructor like WikiPageFactory. [17:24:52] "Themeing" isnt a factory, so not sure what you're trying to do there, but if you're passing a factory to a special page you need to list it in the "Services" bit in Extension.json iirc [17:26:47] Oh actually ignore what i just said i didnt see the construct at the top [17:26:53] Only the parent call [17:27:58] yea :p im just working wiht the greek documentation [17:31:21] do I need to tell it hey can you please give me a factory here? [17:59:29] [1/17] I'm pretty sure you need to do something like: [17:59:29] [2/17] ```json [17:59:30] [3/17] "CreateAchievement": { [17:59:30] [4/17] "class": "SpecialCreateAchievement", [17:59:30] [5/17] "services": [ [17:59:30] [6/17] "RepoGroup" [17:59:31] [7/17] ] [17:59:31] [8/17] } [17:59:31] [9/17] ``` [17:59:32] [10/17] is what I'm doing for my achievement extension and then: [17:59:32] [11/17] ```php [17:59:33] [12/17] public function __construct( RepoGroup $repoGroup ) { [17:59:33] [13/17] parent::__construct( 'CreateAchievement', 'createachievement' ); [17:59:34] [14/17] $this->repoGroup = $repoGroup; [17:59:34] [15/17] } [17:59:35] [16/17] ``` [17:59:35] [17/17] Maybe try somehting like that? [17:59:36] but using WikiPageFactory as the service? [18:01:56] Yeah that looks good, although I will note, using RepoGroup in DI I have found to cause a problem sometimes if using certain other services there also, as services then call themselves and it causes a service infinite loop which I only realized recently so be careful with what services you actually use together sometimes lol [18:02:53] oh interesting I haven't experienced that yet [18:04:36] Yeah for some reason I think using both RepoGroup and FileBackendGroup or something and both called MimeAnalyzer or something then it called itself and looped into a service loop. It didn't work taking one out so I had to take both out. [18:06:20] https://github.com/miraheze/MirahezeMagic/pull/472 is where I experienced it [18:14:18] i think they make it a bit convoluted uploading a file in an extension anyway took me a few days to figure it out messing with stashes and stuff like that [18:15:30] It took me what seemed like forever to figure out how to do the uploading logic when making ImportDump lol [18:15:57] In the end I did my own way that was cleaner then ones like how SocialProfile does it and how core does it [19:05:15] hooooly shit [19:05:44] [1/2] @originalauthority first try 😄 [19:05:44] [2/2] https://cdn.discordapp.com/attachments/1006789349498699827/1231319913348726826/3Fc0I9s.png?ex=66368708&is=66241208&hm=65d4c0c46a88b289834a7dd6f3a880323da80639c8f2bec93ac750bd36e49b19& [19:06:08] (that I actually managed to use it) [19:06:50] Ay well done [19:07:28] I'm thinking if I should work on A) loading the existing values as defaults or B) making the colors actually apply [20:31:12] who knew reading the page back would be just as much of an issue [20:32:21] What's the proper way to get a page's contents , closest I found is Content->serialize() [21:04:36] https://www.mediawiki.org/wiki/Manual:WikiPage.php [21:04:50] Oh so in page not contents [21:04:54] [1/5] tl;dr [21:04:55] [2/5] ```php [21:04:55] [3/5] $content = $wikiPage->getContent( RevisionRecord::RAW ); [21:04:55] [4/5] $text = ContentHandler::getContentText( $content ); [21:04:56] [5/5] ``` [21:05:18] I’ll get the hang of this mess eventually I promise 😭 hats off to you guys who keep track of all this [21:05:35] honestly mediawiki.org is the saviour [21:05:45] Yeah definitely [21:05:49] It has all the info I need [21:05:52] also this as well: https://codesearch.wmcloud.org/search/ [21:05:56] The issue is I don’t know where to look [21:06:15] if you're ever unsure of how to use something like say you want to use WikiPage class, i usually type in WikiPage and see how other people are using it [21:06:19] The connections between topics aren’t very clear to me personally [21:06:30] Oh yeah extensions are in code search [21:06:48] yeah its a bit all over the place because they're namespacing stuff so there's a bit of duplicate code everywhere and moving away from globals [21:07:02] for example you used to be able to do $wgUser for user stuff but thats depreciated now [21:07:07] The only extension I thought of that read json pages was Secure poll so I was considering looking there [21:10:44] _is finally getting set up with docker, in other news_ [21:11:22] Welcome to the club [21:11:37] If [[mw:cli]] counts [21:11:40] [21:12:28] i've never used that tbf [21:12:38] i think its easier to just set a quick vm on docker or on mac itself [21:12:49] but for some reason my macbook won't install php extensions so [21:13:01] I’m too lazy to set up an entire environment so :p [21:13:14] The cli also makes stopping and starting east [21:13:41] i've got 15050348 side projects going on so i might aswell [21:14:52] I have this and a Python one [21:15:00] HiveBot: [21:15:07] https://tenor.com/view/palla-deserto-desert-hot-gif-6014273 [21:46:40] the deprecation notice is just for decoration right? [21:47:53] What does it say [21:48:13] https://cdn.discordapp.com/attachments/1006789349498699827/1231360803861696584/de3C8Xo.png?ex=6636ad1d&is=6624381d&hm=3ca73f98994508f8b13e21b137e99c0854f7ca48f9277a97d25ac11fe63d54d1& [21:49:25] Are you using phpstorm? It should tell you what the new version is [21:49:29] Like what to use instead [21:51:10] ah there it is [21:51:14] ::getText [21:51:19] it was on the bottom [21:51:25] new to PHPStorm [21:51:29] thank youu [21:53:13] i really need to make a git project or something to have an issue tracker and stay organzied(thought of it cause I saw mw as expect don't make the content model json unless it ends in .json in case someone wants to configure it to use like Mediawiki:Themes) [21:53:28] don't suppose i can use our phorge tracker \joke [21:57:22] well seems to read the value from the page. now to get defaults working [21:58:38] oh wait think i see the issue json_decode is returning stdClass :squint: [22:01:09] [1/2] that was, shockingly easy. all I needed was to pass a true bool to json_decode() to return as array. StackOverflow my king [22:01:09] [2/2] https://cdn.discordapp.com/attachments/1006789349498699827/1231364044938805288/BwBN83C.png?ex=66258ca1&is=66243b21&hm=83ff9b941bb9fc23d2ce6fce35fe14288010a3aadf9ba6c370705e0df0951452&