[00:02:12] Why is mediawiki so ugly? [00:04:30] Yea that's right [00:04:32] name me 666 [00:05:00] Why are you guys so quiet [02:12:11] If a sun went every were you went would you say he or she is the eye of raw [06:56:35] Hi. How can I use Google Translate or Yandex Translate to translate a text in mediawiki markup retaining that markup in the translation? [06:58:49] gleki: look at Translate and ContentTranslation. I don't recommend trying to Translate manually [17:32:25] Out of curiosity, does anyone here have experience updating Mediawiki plugins from using require_once to using wfLoadExtension? [18:27:25] Choco31415: you need to create an extension.json file for them [18:27:29] once you do that, you can switch [18:27:46] (the php entry point is also no longer required) [18:28:08] if you have any more specific questions, feel free to ask [18:28:30] otherwise looking at existing extension's extension.json files can give a good overview of how they are formatted [18:29:27] also there seems to be a maintenance script to do it: https://www.mediawiki.org/wiki/Manual:Extension_registration#Migration_for_extension_developers [18:30:28] I'm currently in a Google Hangout, but I will try to double task. [18:30:31] I tried that script. [18:30:34] It did not work. [18:30:51] I'll get the error message in a moment. [18:31:30] call_user_func() expects parameter 1 to be a valid callback, function 'sbSetup' not found or invalid function name [18:32:03] MWException: Invalid callback sbParserInit in hooks for ParserFirstCallInit [18:41:21] Skizzerz: ^^ [18:42:03] it sounds like your extension has some sort of weird setup thing going on so you'll probably have to make the json file manually [18:42:35] Is there a manual tutorial? [18:43:51] look at examples from other extensions, do what they do [18:45:07] https://tools.wmflabs.org/extreg-wos/schema.html is an overview of all of its fields [18:48:38] I will look and report back with my results. [19:13:55] I need to find out how to properly make callbacks... [19:53:20] Choco31415: callbacks for what? [19:53:26] and what do you mean by "properly" [19:55:37] There are two php functions that I need to run, and I think I do that through callbacks. [19:56:24] A hook: sbParserInit(Parser $parser) and an extensionFunction: sbSetup() [19:56:55] Properly as in without bugs. [19:59:17] Choco31415: do you have copde that is broken, or are you looking for a place to start? [19:59:33] I have an extension.json file [19:59:39] The PHP code is not broken. [19:59:49] I'm just not sure how to run it from the extension file. [20:00:24] I guess I'm looking for a place to start? Google and Skizzerz links above haven't helped much, besides pointing me towards callback. [20:01:14] Ah. extension.json is pretty new, so the documentation about parser functions doesn't mention it. [20:01:20] i havn't used it too much myself, yet. [20:01:56] To be truthful, I'm new to developing MW extensions. [20:05:39] Choco31415: that's fine. So here is how to register a handler function (aka callback) for a hook from extension.json: [20:05:41] https://phabricator.wikimedia.org/P2981 [20:05:42] Choco31415: it may help if you provide a link to your extension's code [20:06:04] Choco31415: for that to work, the callback has to be a static function. [20:06:38] The entire extension, or just the extension.json? [20:06:47] I'll try Daniel's link first. [20:06:51] Choco31415: inside that function, you register your parser function handler. That can also be a static function, if you like. [20:08:30] Where do you define "MyThingy::onParserFirstCallInit" ? At class MyThingy and static method onParserFirstCallInit? [20:09:23] Choco31415: yes, exactly [20:09:30] Choco31415: i have updated the past. [20:09:35] *paste [20:10:25] Where would I put the php file with the MyThingy class? [20:10:34] Would I define that through AutoLoadClass? [20:10:49] Choco31415: yes [20:11:01] Choco31415: the path there is relative to your extension's directory [20:11:10] Trying... [20:14:02] Woah, my error log exploded. [20:14:46] http://pastebin.com/QHQXW7Fj [20:16:03] I'll make the functions public and try again. [20:17:39] class "ScratchblockHooks" still not found. [20:18:57] Choco31415: then something is wrong with the autoloading. or file permissions. [20:19:10] Choco31415: please paste y How about I share the extension? [20:19:46] Choco31415: sure, put it on github or wherever [20:21:17] https://github.com/Choco31415/ScratchBlocks [20:21:40] Skizzerz: I shared it. [20:23:49] i'll look in a bit [20:24:06] Choco31415: hm, looks ok to me. but haven't tried. [20:24:21] I have a MW running from xampp that I can easily test changes on. [20:24:27] MW 1.26 [20:25:52] On the bright side, if we can't get wfLoadExetension support, the extension works using require_once. [20:28:06] Wait a minute, I noticed something. [20:28:27] Choco31415: you have a ScratchBlocks.php and an extension.json. You should only have one or the other (or ScratchBlocks.php should do nothing but call wfLoadExtension( "ScratchBlocks" ) ). [20:29:10] I just noticed that I need to update some $parser->setHook methods. [20:29:14] Choco31415: I suspect you are using the extension "the old way" via require_once( "$IP/extensions/ScratchBlocks/ScratchBlocks.php" ) [20:29:20] that will bypass extension.json. [20:29:31] I will try that Daniel when I can get the extension working via wfLoadExtension. [20:29:40] I checked and I am using wfLoadExtension at the moment. [20:29:59] the "new style" is calling wfLoadExtension( "ScratchBlocks" ). But this bypasses your old ScratchBlocks.php file! [20:30:22] Choco31415: you will have to move everything that is in ScratchBlocks.php somewhere else. Into the hooks class ot the extension.json file or some other class. [20:30:33] Yes, which is why I'm trying to migrate the scratchblocks.php code to somewhere the extesio.json can run it. [20:30:34] (plain global functions are discouraged) [20:30:54] It's currently in ScratchblockHooks.php. [20:31:04] well the extension function looks to be possibly superfluous, I think there may be a way to just say "always add this module to the page output" without needing it [20:31:07] need to check that though [20:32:22] I moved Scratchblocks.php to a temporary location for now. [20:32:28] Aka out of the extension. [20:33:19] Choco31415: oh, $parser->setHook('sb', 'sbRenderInlineTag') will not work. you need $parser->setHook('sb', 'ScratchblockHooks::sbRenderInlineTag'); [20:33:59] it'S a static method now, no longer a global function [20:36:34] Sorry, my wifi cut out. [20:36:51] I implemented the change. Now we just need to see how MW reacts. [20:37:50] And my MW test page fails to load completely. [20:39:49] Choco31415_: *sigh* that's how it goes ;) [20:39:51] It still does not work. [20:39:57] check the error log [20:40:10] may just be a syntax error somewhere [20:40:13] Sorry, I got the page to load on the local machine, but not on my laptop. [20:40:24] MW is on a PC, I am on a Mac. [20:40:43] Aka I have a dual computer set up here. :D [20:41:24] MW is thrown this error: http://pastebin.com/QHQXW7Fj [20:43:31] By the way, I just realized, I can't exactly get rid of Scratchblocks.php. This extension is supposed to work on MW 1.18 - 1.26. [20:44:27] Choco31415_: then you can't use extension.json at all, i think [20:44:32] you'll have to do it the old way. [20:44:41] you have both [20:44:44] *you can have both [20:44:52] Skizzerz: but then you need to do weverything twice [20:44:56] yes [20:44:56] that doesn't make sense [20:44:58] why wopuld you? [20:45:10] old way is deprecated? [20:45:12] the old style still works with new versions of mw. just use that [20:45:20] deprecated means it'll be removed eventually [20:45:27] Skizzerz: sure. but better use a deprecated function than to duplicate code [20:45:37] Someone from miraheze, a nonprofit wiki farm, request wfLoadExtension support. [20:45:49] *requested [20:46:59] Choco31415_: well, if you want wfLoadExtension support and want to be compatible with old versions, you'll have to maintain the setup twice, i guess. or write your own compat shunt: load and evaluate extension.json yourself, from inside your extension php.- [20:47:32] Skizzerz: sure. and when it gets removed, you hopefully don't have to support very old versions any more [20:48:18] I can do that.I have to support them because there are several wikis that I am in charge off that run pre MW 1.25. [20:48:47] *I have to support require_once [20:49:29] For now, I'm focusing on adapting the plugin for MW 1.25+. [20:50:39] Wait, do I need a callback? [20:51:45] you can maintain separate branches of your extension for each MW version, instead of pretending compatibility with all versions on the latest one [20:52:14] that's how it's done usually [20:52:47] That's what I was thinking of too. [20:53:00] Wait, haven't I met you before? [20:53:25] maybe, I'm usually here everyday, but only few hours [20:54:00] I think I had your help one time. I forget what about, though. [20:54:25] if your extension doesn't break because of extension.json compatibility, it may break because some hook that your extension depends on has changed parameters or whatever... [20:55:08] It's breaking because it can't find the class with the hooks. [20:55:29] Error log here: http://pastebin.com/QHQXW7Fj [20:56:43] For you: https://github.com/Choco31415/ScratchBlocks [20:59:52] I can't help on that, I touch very little PHP nowadays [21:00:54] It's okay. [21:01:06] On the bright side, I confirmed that the class is being loaded through AutoloadClasses. [21:04:34] What was class::method called again? [21:07:20] My error log is gone! [21:07:27] So is my working extension! [21:08:58] DanielK_WMDE: Good news. I fixed the error and no new errors appear. Bad news. The plugin does not work. [21:11:27] It looks like my hook is not being called. [21:11:38] At least it's accessing the class properly now. [21:13:55] DanielK_WMDE: What's the different between $parser->setHook and $parser->setFunctionHook ? [21:15:50] https://www.mediawiki.org/wiki/Manual:Parser_functions#The_setFunctionHook_hook [21:15:55] https://www.mediawiki.org/wiki/Manual:Parser.php [21:17:10] Ah, thank you! [21:19:01] The second link has both of them [21:19:08] under the set header [21:19:23] I saw. From that, I want to stay with setHook. [21:22:11] New news! I checked, and my hooks are properly bring called. However, the methods I'm passing into $parser through setHook are not running. [21:23:54] What are you passing? [21:24:48] Here's what I'm doing: [21:25:07] $parser->setHook('scratchblocks', 'ScratchblockHook::sbRenderTag'); [21:25:33] And what is the method signature of sbRenderTag? [21:26:18] public static function sbRenderTag($input, array $args, Parser $parser, PPFrame $frame) { [21:28:22] I've never seen someone put data types in function parameters [21:29:56] wikideer: it's called type hinting. helps to catch errors. available since php 5. [21:30:27] By the way, Danial, my work is viewable on Github. [21:30:34] it's generally a Good Idea (tm) [21:36:35] So I don't want to be /that/ guy or anything [21:36:58] But you class is ScratchblockHook and you're adding hooks for the class ScratchblockHooks [21:37:05] your* [21:37:12] I fixed that since. [21:37:44] I'll push it to Github so that you can see. [21:37:55] And it's pushed. [21:38:15] It includes one of my experiments. [21:38:25] Oh... [21:38:48] Okay, you can look now. [21:39:05] https://github.com/Choco31415/ScratchBlocks/commits?author=Choco31415 [21:39:58] Where are you doing: $wgHooks['ParserFirstCallInit'][] = 'ScratchblockHooks::sbParserInit'; ? [21:41:03] I'm going that in extension.json. [21:41:15] That's not how it works? [21:41:36] Hooks...ParserFirstCallInit...ScratchblockHook::sbParserInit. [21:41:45] It's working that way. [21:41:49] I thought you had to do it via PHP [21:42:00] Since when did MW add JSON stuff like that? [21:42:13] Mediawiki added JSON stuff like that in v 1.25. [21:42:44] Ever since it deprecated using name.php as an entrance point for the extension. [21:43:06] Actually, it might have come earlier. 1.25 is just when ^^ got deprecated. [21:43:27] How about I try your method? [21:43:28] I have been using 1.19 [21:43:52] Of, that's the old method. [21:44:26] I used that, however I can't use wgHooks anymore because I'm trying to covert the plugin to work with wfLoadExtension. [21:44:36] Aka MW 1.25+. [21:45:24] tbh I have no idea at this point [21:46:03] Still, you were helpful. :) [21:46:19] I'm currently looking at this: [21:46:19] https://www.mediawiki.org/wiki/Manual:Tag_extensions [21:46:22] I am behind in terms of MW stuff [21:46:34] I will probably be on 1.19 forever [21:46:57] Two weeks ago, I did not think I would even be learning so much MW. [21:48:22] I will probably jump back in at the next LTS release [21:48:30] LTS? [21:49:17] !lts [21:49:18] Current long-term support release is 1.23. The legacy lts is 1.19 and will be supported until May 2015. https://www.mediawiki.org/wiki/Version_lifecycle#Versions_and_their_end-of-life [21:49:29] It's 2016 already. [21:49:37] I know [21:49:41] lol [21:49:45] But 1.19 just werks [21:50:08] Now you're sounding German. [21:50:28] I like this LTS [21:50:30] Another [21:51:26] Oh god I've become a corporation [21:51:45] Using software after it's EOL because it's too much hassle to upgrade [21:53:41] Oh deer. [21:53:56] Oh deer indeed [21:54:13] ff [21:54:24] That's better [23:06:20] Test: Is my connection still good? [23:06:37] yes [23:07:16] Choco31415_ you're still here. Nice pi reference btw [23:07:29] Thank you. :) [23:08:00] On that note, my MW extension is still not working. [23:08:33] Is anyone here assisting you? [23:08:53] wikideer-eol was, but couldn't make heads or tails of it. [23:09:06] I just joined [23:09:30] The extension is for MW 1.25+ [23:09:31] https://github.com/Choco31415/ScratchBlocks/commits?author=Choco31415 [23:10:18] The current problem is that in ScratchblockHooks.php, the setHooks are running, but not their hooks. [23:11:17] that's a nice idea for an extension [23:11:35] So you know about Scratch? [23:11:47] I've heard of it, yes [23:11:49] not used it [23:12:29] huh, interesting. [23:12:43] let me look at the hooks 1 sec [23:15:48] Choco31415_: was it working before? [23:16:11] I overhauled the plugin to use wfLoadExtension instead of require_once. [23:16:16] is the exception getting thrown? [23:16:22] If by "before" you mean when I was using require_once, then yes. [23:16:26] No exceptions at the moment. [23:16:52] At least, none on the MW page itself. [23:18:00] There was an error related to Special:RecentChanges, but the page itself worked. [23:19:00] go to the extension.json [23:19:09] oh wait nvm [23:19:26] The file is ScratchblockHooks so it is right [23:21:40] it looks like it should work [23:22:21] Choco31415_: are you sure sbParserInit() is running? [23:22:26] Yes. [23:22:49] If I put in "throw new Exception", I get an exception. [23:23:15] C:\xampp\htdocs\mediawiki\extensions\ScratchBlocks\ScratchblockHooks.php: 23 - Just as wanted. [23:24:13] does it work without the 'ScratchblockHooks::' in the setHooks? [23:24:39] Nope. [23:24:56] In ScratchblockHooks.php or extension.json? [23:25:11] I was looking at the former [23:25:37] That was for the former. [23:26:56] I have checked, and $parser is not null. [23:29:42] I did a var dump of the parser info, and this is what I got: [23:29:58] http://pastebin.com/zKLk7uX4 [23:34:00] Hey wikideer! [23:34:05] Hi [23:37:23] Finally, I got a descriptive error! [23:37:23] C:\xampp\htdocs\mediawiki\includes\parser\Parser.php: Tag hook for sb is not callable [23:37:48] Windows [23:37:53] That's odd, because sb is the second tag, so I imagine I would get an error on the first tag. [23:37:59] Great for 99% of things [23:38:06] MediaWiki is not one of them... [23:39:03] I commented out the sb tag. [23:39:03] C:\xampp\htdocs\mediawiki\includes\parser\Parser.php: Tag hook for scratchblocks is not callable [23:40:04] I think I fixed it. [23:40:07] *crosses fingers* [23:40:16] It works! :D [23:40:22] congrats [23:40:24] I didn't even change the page [23:40:26] sorry for not helping :P [23:40:34] I meant, I didn't change the extension. [23:40:45] These are the best kind of bug fixes. You do nothing, and then it fixes itself. [23:40:52] You were helpful huh. ;) [23:41:03] For moral support, if not coding support. [23:41:19] Literally, I've been working in this bug since 2PM. Aka, 5 hours. [23:41:28] Then again, I did take a 1 hour break. [23:42:14] Almost fixed. [23:42:22] One of the tags is not working. [23:43:16] All I did was preview the page, and it started working. [23:43:18] What?? [23:43:24] This is weird. [23:43:34] maybe it was a cache issue XD [23:43:50] That, and I replaced some code in the setHook. [23:43:55] I'll push it, so that you can see. [23:44:18] Pushed. [23:44:33] wikideer: Good news ^^. [23:45:01] Good [23:46:58] I'm going to try a clean reinstall of the extension to see if anything weird pops up, like right now ^^. [23:48:40] The clean install worked. Huzzah! [23:49:16] Finally, 9 hours gone into allowing wfLoadExtension. [23:49:24] Actually, more like 8. [23:49:26] *7