[01:53:28] Fandom have, IIRC <-- and now that they've finally managed to upgrade their forked MW, it's proprietary again :( [01:57:16] * perryprog sticks tongue at Fandom [02:01:13] > MediaWiki 1.33.3 [02:01:34] yeah they definitely should have waited for an LTS [02:41:55] AntiComposite, they're going to 1.37 in the literal next week or so [02:42:09] or it's some continuing upgrade at least [02:42:50] I guess it's better than going to 1.36, since that'll be out of support in a month, instead of a few months [02:43:30] (before anyone asks, yes Fandom does usually backport security patches) [02:44:07] though 1.33.3 isn't even the latest 1.33, so ¯\_(ツ)_/¯ [03:37:57] dey took 'er wekkies! [04:10:58] I'm trying to think what seems like the most reasonable entry point for a wiki page to make use of the JS PhotoSwipe library (that can be provided by an extension--that I'm working on). From a wiki page, .... using a Template? hmm... a Module? nah, that's Lua, not JavaScript, a MediaWiki:Gadget-PhotoSwipe.js script? mmmmmmmm, maybe not? Maybe the extension should provide a tag that can be used? [04:10:59] and if so, then templates can be built around using that, and then the templates using in wiki pages? [04:12:38] I don't know what photoswipe is, but i assume some sort of image gallery thing? If so, its possible for extensions to add new types to the tag. That might be an option [04:12:53] ah, I'll look into that! Thanks! [04:16:20] https://en.wikipedia.org/wiki/Help:Gallery_tag -- however, so as to not get too confused, the PhotoSwipe gallery will not affect the layout of the content on the page, and will only be triggered upon clicking (e.g. an image or other link) to actiate a popup keypress slideshow (click/drag/swipe to change pictures) [04:16:41] So, in that of usage of tag, would that cause any possible interference? [04:17:52] especially the contents inside of would be entirely JavaScript configurations only, and not any actual image contents, other than ID/class identifiers that already exist or can be created in the page [04:18:28] If you use https://www.mediawiki.org/wiki/Manual:Hooks/GalleryGetModes you can make the mode parameter output any html you want, including just changing an id. Or something totally different if that's what you want [04:46:12] Nice! Also, damn! I just searched all 800+ extensions with v1.37.x release, and only one other extension uses the GalleryGetModes hook: AutoGallery [04:51:32] You could probably look at how core modes are implemented. It would be very similar except for the registration part [04:54:29] Sure! Also looking into how to trigger the GalleryGetModes hook using wikitext `test` at https://dev.moasspedia.org/wiki/List_of_ape-made_artwork with public static function onGalleryGetModes( array &$modeArray ) { echo 'debug';exit; } doesn't seem to work yet, I'm still learning/looking into this [04:57:37] As a general rule, use var_dump() instead of echo for debugging things. Echo often doesn't show up, but var_dump will almost always be outputted [04:58:10] Did you register the hook function (either in extension.json, or by adding it to the $wgHooks['GalleryGetModes'][] array)? [05:03:14] extension.json for PhotoSwipe extension has --> "Hooks": {"GalleryGetModes": "PhotoSwipe::onGalleryGetModes"} -- does that register? or is there something else that needs to be done to register? [05:04:20] That looks right [05:04:52] As long as you have wfLoadExtension( 'PhotoSwipe' ) in your LocalSettings.php [05:05:47] oh, in dev environment, I probably forgot that part, lol, i've been developing in production. That's probably the problem [05:06:29] You can also verify by checking api.php?action=query&meta=siteinfo&siprop=showhooks to see if its listed [05:15:26] extension.json "MediaWiki": ">= 1.37.2" -- I changed this to 1.37.1 for dev environment (didn't upgrade that yet) but I am curious for production release, to backtrack the oldest version that the extension would work with [05:19:52] but otherwise `public static function onBeforePageDisplay(&$out, $skin) { var_dump(0);exit}` works, but `public static function onGalleryGetModes( array &$modeArray ) {var_dump(1);exit;} // after removing the other var_dump(0);exit) the other one doesn't show still. [05:21:04] in dev environment https://dev.moasspedia.org/wiki/List_of_ape-made_artwork with PhotoSwipe extension enabled should be accessible to everyone (not just me) now [05:21:48] Are you viewing a page with a tag on it (And the page is not cached. For example, using Special:ExpandTemplates) [05:23:00] https://dev.moasspedia.org/w/api.php?action=query&meta=siteinfo&siprop=showhooks shows -> {"name": "GalleryGetModes","subscribers": ["PhotoSwipe::onGalleryGetModes"]} [05:23:35] [It can be hard to test with normal pages - if its saved, it is probably being served from cache, and on show preview, you might get rendered via API stash edit] [05:23:42] https://dev.moasspedia.org/w/index.php?title=List_of_ape-made_artwork&action=edit at top i added test\ntest2 [05:24:00] oh right, but I think I have cache disabled in dev environment [05:24:09] I'll double check [05:24:40] Yeah, it looks like it was cached. When i did ?action=purge, int(4) showed up [05:24:49] oh, but otherwise, I can get the var_dump outputs for other hooks, so I'm not sure it's a cache issue [05:24:59] oh, then it was cached [05:25:05] Keep in mind, even if $wgMainCacheType = CACHE_NONE; parser cache is still enabled [05:25:22] how can I disable parser cache for dev environment? [05:25:45] you're other hooks might fire on every page load potentially. The gallery one will only be hit when mediawiki needs to figure out how to render a gallery [05:25:47] https://mediawiki.org/wiki/Manual:Parser_cache [05:25:55] $wgParserCacheType = CACHE_NONE; [05:27:14] Reedy: aye I guess I need to figure out profiling [05:27:47] for now going to try flipping back to 7.4 to see if it was really the version switch [05:38:45] ugh, is there no way/hook to disable an api module [05:48:36] Best documentation ever! https://mediawiki.org/wiki/Manual:TraditionalImageGallery.php (same with Manual:SlideshowImageGallery.php, Manual:PackedOverlayImageGallery.php, Manual:PackedImageGallery.php, Manual:PackedHoverImageGallery.php, Manual:NolinesImageGallery.php, and Manual:ImageGalleryBase.php) [05:49:39] I'm surprised we have tose pages, like what's even the point [05:51:29] Also I like how the PackedHoverImageGallery class adds 0 things [05:52:36] something about different CSS I guess, probably referenced from somewhere else [05:58:28] ryzendar: yeah, its just whether the image caption is always shown, or just shown on hoover [06:07:26] my favourite part about PHP is how unpredictable it always is, for example, https://www.php.net/manual/en/function.array-key-exists.php gives me undefined identifier errors on 8.0 [06:12:11] …but it works if I disable opcache, cool [07:09:09] Aha! extending class ImageGalleryBase calls toHTML(), which checks for $this->getModules() before hook BeforePageDisplay, so I should probably not use that hook to addModules. [07:12:25] I suppose I could use the toHTML() function to addModules [07:22:51] hmm, in toHTML() $this->mImages contains all the text data inside of and which is not raw exact content unparsed. i can try to stitch this back together to be raw text data to reparse a different way, but I am trying to find a different way to extract the raw data between the tags. [07:51:52] If you need the totally unparsed text, might be easier to make your own extension tag [08:01:09] Remilia, I haven't been paying attention to php development culture, but if there's a fork, I suggest d4d (php rotated 180 degrees) as the new name, lol [08:57:38] Ah, extension tags are even better! I can work with $args instead! That way instead of LocalSettings.php configuration only for the wiki admin, each usage of the tag can have access to configuration instead! This enables more than one implementation of using the library to exist! [20:21:32] For extension, I executed `composer require respect/validation` and in my extension.json's AutoloadClasses PHP script file I added line `use Respect\Validation\Validator as v;` but when I try to use it, I see " Error: Class 'Respect\Validation\Validator' not found" [20:22:24] I glanced through all the other extensions to see if any use vendor/autoload.php but it seems not, so I didn't want to use that in the extension [20:22:48] Don't add it manually to autoload classes [20:23:14] The magic you want in extension.json is "load_composer_autoloader": true [20:23:23] it will load the vendor folder from inside the extension (if it exists) [20:25:17] Aha~ I didn't see that mentioned in https://mediawiki.org/wiki/Composer but searching for "load_composer_autoloader" I see it in https://mediawiki.org/wiki/Manual:External_libraries [20:25:46] otherwise linked in "How to add external libraries to MediaWiki core or extensions" at the bottom of Composer page [21:45:30] return wfMessage( 'photoswipe-key-not-found' )->escaped(); // shows '"`UNIQ--photoswipe-00000000-QINU`"' but also https://mediawiki.org/wiki/Manual:Messages_API suggests to use RequestContext instead. I'm looking into returning error messages in wiki pages for incorrect usage of extension tag [21:45:49] I suppose I have to define custom i18n language messages for the value. [21:46:06] I only know English. How do I generate the message for other languages? [21:46:19] You ask translators to [21:46:23] But they will fallback to english [21:46:32] Also, those are strip markers... [21:46:41] I'm not sure RequestMarker will necessarily help [21:47:02] Your message seems to contain a tag, that's being parsed [21:50:33] also, is it acceptable to use wfMessage() for outputting error/warning messages? [21:50:59] to be returned in the page output without breaking the page