[00:23:36] Q: What is wgRelevantArticleId, and can it be reliably used to tell whether the page being viewed exists yet? [00:24:58] (if not, is there any way to do that without asking the API?) [00:33:37] https://www.mediawiki.org/wiki/Manual:Interface/JavaScript#mw.config [00:33:47] probably the id portion of wgRelevantPageName? [00:35:45] hmmm, that's probably not what I'm looking for, then. [00:35:51] maybe wgRevisionId? [00:36:22] I'm trying to determine whether the edit screen is a create-page screen, mainly [00:38:10] YairRand: wgArticleId == 0 [00:38:38] legoktm: excellent, thank you [00:42:05] YairRand: wgRelevantArticleId is set when viewing e.g. Special:Log/Foo, Special:MovePage/Foo, etc., to the page id of page Foo [16:37:09] anomie, several years ago i mentioned to DanielK_WMDE that titlevalue should support interwikis, and even though he agreed at the time, no code changes have been made. I dont want to introduce yet another construct to handle it. [16:37:20] but you bring a valid point wrt uppercase [16:37:32] any suggestions? [16:42:04] anomie, answered at https://gerrit.wikimedia.org/r/#/c/284469/ [16:42:37] yurik: Not really. It seems to me that JsonConfig's interface is a bit confused, being able to use local titles and pseudo-titles that look local (and get parsed by local rules) but are really on some remote wiki. It might have been clearer to use actual interwiki titles for the interwiki titles, or to just not use titles at all but instead some identifier that the backend would convert into the appropriate title or remote call. [16:43:31] anomie, doesn't interwiki also being parsed by the same title code? [16:44:36] Interwiki sees "foo:namespace:page" and splits it into interwiki=foo, title="namespace:page" without munging it further since it doesn't know what the remote site is going to do with it. [16:45:24] anomie, would it be possible to make "data" the interwiki prefix? [16:45:35] * yurik goes to look at all interwikis [16:45:37] yurik: The other thing that could be done would be to make it like the File namespace, where going to Data:Foo locally would fetch it from Commons. [16:45:52] yeah, that's what i was thinking [16:46:05] i wonder if it would conflict with anything [16:46:28] but i really don't want to introduce shadow namespace for this - it wouldn't work for data [16:46:52] yurik: One of the things I've heard legoktm talk about is generic shadow namespaces. [16:47:51] yes, but shadow namespaces are not good for data - imagine you have a big table of data, and a local wiki wants to override that - they will have to copy the whole thing and make local changes - which imo kills the whole idea [16:48:24] How do they do it now? [16:48:36] the same way - they copy stuff [16:48:48] plus there is no data now [16:49:02] so that's not an issue :0 [16:49:05] :) [16:50:16] most of the data usages won't be from wikimarkup, so the page title is not as important - it will only come from inside the graph and from lua [16:51:13] i have only came up with the idea of direct title usage to create a "source" tag - e.g. if graph or table uses data, there is an easy way to create a link to the source data for editing [16:51:44] something like {{#datasource:CommonData.tab}} [16:52:14] otherwise there is no [[data:blah]], or any other fancy markup [17:03:30] yurik: errr, TitleValue supports interwikis [17:03:58] https://gerrit.wikimedia.org/r/#/c/285576/ [17:04:00] :) [17:05:17] legoktm, awesome! is it possible to use it to parse unregistered interwiki? [17:06:59] legoktm: Oh, someone finally fixed that. Good! [17:09:13] yurik: parsing is handled by MediaWikiTitleCodec which checks Interwiki::isValidInterwiki(), but you can create TitleValue objects with arbitrary interwiki prefixes and TitleFormatter will format it as you'd expect [17:25:21] legoktm, could you take a look at the getData() comments at https://gerrit.wikimedia.org/r/#/c/284469/5..8/includes/JCLuaLibrary.php [17:26:11] the titlevalue part? I'm not super familiar with scribunto things [17:26:26] given a string, i need to treat it as a title of page in another wiki, without introducing a local namespace, but i need to fully resolve it in order to be able to use shared cache [17:26:46] legoktm, yeah, just the title part, ignore the lua stuff [17:28:52] Hmm, I'm not really sure. [17:29:11] TitleValue can now be used for interwiki stuff, but TitleFormatter expects and needs the namespace to exist locally [17:30:53] legoktm, i don't need to format it, just to parse it [17:31:06] normalize it, without localization [17:31:36] basically i need to convert any string to an invariant dbkey in another wiki [17:31:44] regardless of what is the current wiki [17:31:54] another wiki == commons [17:32:00] well if the namespace doesn't exist locally 'Data:FooBar' is going to have the dbkey part as 'Data:FooBar' [17:32:36] legoktm, right, that's why i don't want ppl to use the "data:" part [17:32:58] it will only be used via specialized lua functions and inside the graph, both of which understand the "data" [17:33:21] so a lua function would say get("FooBar.tab") [17:33:49] so my current code hacks it by prefixing it with a ":" [17:34:06] I guess that would technically work...? [17:34:09] and parses, and then uses the data namespace ID [17:34:20] which only exist in commons [17:34:24] I think you're going to run into weird edge cases [17:34:31] but anomie raises valid concern - capitalization [17:34:56] yeah, right now Special:GlobalUsage on commons is broken for Wiktionaries [17:34:57] so i could also say that data namespace must be capitalized [17:35:27] in the jsonconfig settings, so that when the titlevalue is created, it also capitilizes the first letter [17:35:37] what's broken with wikt? [17:36:02] https://commons.wikimedia.org/wiki/Special:GlobalUsage "Usage at Wiktionary may be incomplete, as Wiktionary has case-sensitive first characters and lowercase uses are not listed." there's a bug for it somewhere [17:36:26] yurik: using Language::ucFirst() ? that should probably work... [17:36:28] ah, right, so i shouldn't have that issue because all the links are one way - from all wikis to commons [17:36:43] aren't you going to track usage somehow? [17:36:50] for cache invalidation? [17:36:53] not even language, because it should be language-invriant [17:37:21] legoktm, yes, but that's a separate issue - max is working on the global tracking thingy [17:37:28] it will be hash based [17:37:38] e.g. graph hash -> list of global pages that use it [17:38:02] or list of global data objects that contribute to the creation of it [17:39:04] so for now just need to figure out the title parsing bit and the usage. its ok if it doesn't track it from the very start [18:01:56] tgr: now a good time to regroup with anomie and me? or should we reschedule? [19:05:36] !pastebin [19:07:14] Krinkle: Could you please review my idea http://pastebin.com/sHce6E7T and possibly add it to https://phabricator.wikimedia.org/diffusion/MW/change/master/resources/src/mediawiki/api/category.js [19:08:27] Technical_13: Could you file a task on phabricator and tag with MediaWiki-API, JavaScript, Easy? [19:08:46] Technical_13: Also note that the categories of the current page are also exposed via mw.config.get('wgCategories') which you can do inArray or indexOf on. [19:09:06] Only if you're on the page. [19:09:12] Technical_13: Sure. [19:09:25] Technical_13: If you are, then that will be faster. [19:09:32] The purpose of this is to be able to check if a page is in a category from another page. [19:10:11] k [19:10:18] Anyway, file a task :) [19:10:54] So, If I'm on Category:Pages_starting_with_A and I want to see if one of the members in that category is also in Category:Pages_ending_with_Z --- this will do it. [19:14:49] Krinkle: https://phabricator.wikimedia.org/T135544 [19:15:51] Technical_13: So you'll call this method once for every member? [19:16:03] Yes. [19:16:13] Improvement idea? [19:18:05] What I'm planning on doing with it is having a script ( on http://ddowiki.com ) that will run a script to replace all `(empty)` for sub-categories in a cat with a link to delete the empty cat in one click, but I want to check if the subcat is a maint cat first. [19:19:57] Technical_13: I've amended the task, let's continue there. Note though, I won't be the one implementing this probably. [19:20:05] So, I'll be using it as if ( mw.Api.hasCategory( 'Cat:Sub-cat', 'Cat:Maint Cat' ) { ... alert( 'no deleting maint cats!' ) } [19:20:33] Okay. I only picked on you because I saw your name in the history for category.js