[00:04:06] https://mediawiki.org/wiki/Manual:$wgCSPReportOnlyHeader - I think a word is missing: "if you want to test a potentially _____________________________ change before implementing it." [00:41:45] From 1 -> $parser->setHook( 'photoswipe', [ self::class, 'renderTagPhotoSwipe' ] ); [00:41:52] and 2 -> public static function renderTagPhotoSwipe( $input, array $args, Parser $parser, PPFrame $frame ) { ... } [00:42:34] I am trying to figure out how reference an object from includes/OutputPage.php's OutputPage class [00:43:23] I see that $parser->getOutput(); reaches to includes/parser/ParserOutput.php's ParserOutput class [00:45:10] you could use $wgOut [00:45:43] but calling $wgOut directly from inside a parser tag is probably completely wrong [00:46:41] the very least, you would need to disableCache() [00:46:48] so it doesn't try to use cached contents later [00:46:59] hmm, ultimately I am trying to work with CSP (Content Security Policy) for arbitrary JavaScript code [00:47:23] and I commented these resources: https://mediawiki.org/wiki/Requests_for_comment/Content-Security-Policy and https://mediawiki.org/wiki/Manual:$wgCSPHeader and https://mediawiki.org/wiki/Manual:$wgCSPReportOnlyHeader [00:47:52] and I'm looking into using, for exmaple jQuery.globalEval( config.addBeginning, { nonce: "nonce-2726c7f26c" } ); // replace nonce value [00:48:24] and I'm trying to get the current randomly generated nonce to supply to the jQuery.globalEval statement in JavaScript from a addModule [00:51:21] echo '
' . var_export( gettype($wgOut), true ) . '
';exit; // 'NULL' [00:51:48] Aha! `echo '
' . var_export( gettype($GLOBALS[ 'wgOut' ]), true ) . '
';exit;` [00:56:29] well, I would use global $wgOut; then simply $wgOut [00:56:57] note that if the output is cached, you will probably end up using a nonce from an old execution [00:59:10] At initial thought, I think that will be okay, as long as the nonces match in the headers and used throughout the page. [00:59:34] I'll have to play around and see what happens [01:02:23] Sweet! so far so good! "Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' blob: 'self' 'nonce-67JyqQhoiSbeiCIbsr0R' 'unsafe-inline'". Note that 'unsafe-inline' is ignored if either a hash or nonce value is present in the source list." [02:12:13] Hi [02:12:38] Someone has hacked account how do i delete [02:34:28] MediaWiki Feature Request: Allos extension.json to contain single/multi-line comments! For example see https://packagist.org/packages/adhocore/json-comment [02:44:11] keys that start with @ are ignored, you can use that for comments [03:27:18] "let's make extension.json invalid json" [04:23:33] AntiComposite, Is there anything similar to SASS/SCSS/LESS formats that transpile into valid CSS, but for JsON? Maybe SAJSON (syntactically awesome JSON), or LEJSON (Leaner JSON), lol [04:24:15] and only for stripping comments, nothing fancy like SASS/SCSS/LESS [06:38:22] ryzenda: there are various formats that build on top of JSON with additional features like trailing commas or comments, but the problem is that you then lose the main advantage of JSON, which is that the standard is ubiquitous [06:38:42] elsewhere I've advocated for investigating TOML, but I think we're a bit away from that right now [11:35:45] Sadly even TOML has a lot of jankyness in parsing [11:36:14] There's rarely a good solution for both editing-friendly and computer-friendly structured data [11:38:13] Oh, except for EDN. EDN is perfect. [13:19:54] Trying to get https://www.mediawiki.org/wiki/Extension:LDAPProvider for authentication. Is anyone successfully using it with an anonmous bind_dn instead of a read-only user for authenticating users ? [14:25:56] I'm confused about https://mediawiki.org/wiki/Manual:Config.php because I can get an extension config var to save the value into another variable, but then if I change the value of the global extension config, for example using $GLOBALS[ 'keyofconfig' ] = 'new value'; then the variable string the previous value isn't the same anymore [14:26:55] and the first line of text states read and write, but I haven't noticed any write functions [14:28:09] >Available implementations in core are: [14:28:12] >HashConfig - stores the configuration in a member variable, allowing values to be set, rather than only get. [14:28:18] In theory, you can do some "setting" [14:28:29] But I don't think it's widely used/implemented [14:28:49] Partly because $GLOBALS and global $wg are used all over the place currently still [14:34:13] Also I'm glancing through the code base to find a connection to actually use anything related to the HashConfig class, but it doesn't seem readily available. [14:35:15] includes/specials/SpecialJavaScriptTest.php, includes/installer/Installer.php, includes/installer/WebInstallerName.php, includes/config/HashConfig.php, and includes/libs/eventrelayer/EventRelayerKafka.php [14:35:35] Those appear to be the only files that reference HashConfig class [14:37:26] I think I'm gonna scrap all this bloatware code and just stick to using $GLOBALS and global php function [14:37:42] You'll need to move to it eventually... [14:38:04] And in certain cases, like API and stuff that implements Context, you should be using ->getConfig()->get('Foo') [14:38:54] I will admit that Config.php opening line isn't the most helpful [14:39:08] As Config does not (currently, at least) implement any write [14:39:17] It's just sub implementations that do [14:41:52] I suppose I can keep what I have and adjust writing/setting values to be scoped in different final variable to reference in output [14:42:22] While not completely always true, generally you shouldn't be needing to change the values of globals [14:42:28] Sometimes you might at setup time etc [15:54:35] In extension.json ResourcEModules, the main first module has dependencies including the 2nd module listed. However, I want to remove that dependency form being listed in extension.json and dynamically load it from a hook event such as ParserFirstCallInit hook. In the function for the hook event, I put `$parser->getOutput()->addModules( 'modulename' );` [15:55:17] where $parser comes from public static function renderTagPhotoSwipe( $input, array $args, Parser $parser, PPFrame $frame ) { ... } [15:55:56] It appears that that is not adding the module to appear on the rendered page [15:56:25] I also tried using `global $wgOut; $wgOut->addModules( 'modulename' );` and that did not work either. [15:58:25] Are you sure it's not a caching problem? :-) [15:59:49] Also, it should be addModules( [ 'modulename' ] ) [16:00:02] but that should only result in a deprecated warning [16:00:28] I am not sure, but I purged, and also in my LocalSettings.php I have $wgMainCacheType = CACHE_NONE;$wgParserCacheType = CACHE_NONE; [16:00:39] browser cache :) [16:01:00] I use CTRL+F5 / CTRL+SHIFT+R every time,all day every day,lol [16:01:13] many people don't though, so we have to check :P [17:32:40] is there a query param to show more than 200 items in a category view? [17:34:12] extension.json https://dpaste.org/GJG1M (lines 44-48 are commented, pretend that they are (for #1) not commented and (for #2) not there. Here is includes/PhotoSwipe.php https://dpaste.org/gFLOL [17:35:16] in 2nd dpaste link for includes/PhotoSwipe.php lines 302 to 314 I am testing trying to dynamically load modules that were initiallyin extension.json (#1), and then removed (#2) [17:37:24] both attempts of using $out->addModules and $parser->getOutput()->addmodules (#2 in extension.json) seem to not be producing the same result as if all those lines in the php script are not there (#1 in extension.json that autoloads the modules as dependencies every time) [17:38:02] JavaScript console `Error: Module "js.photoswipe-lightbox" is not loaded [17:38:02] ` [17:38:21] that appears in situation #2 [17:38:26] but not in situation #1 [17:40:39] zuzak, I am beginner, still learning, but searching for answer to learn, I'm currently looking into https://mediawiki.org/wiki/Manual:Hooks/CategoryPageView [17:45:33] zuzak, Also maybe includes/CategoryViewer.php CategoryViewer::formatList() is relevant? https://doc.wikimedia.org/mediawiki-core/master/php/classCategoryViewer.html#abcba878b5440669924cb13b66cf69beb [17:45:52] e.g. $cutoff = 6 in arguments [17:56:56] zuzak I can't find anything else relevant. https://mediawiki.org/wiki/Manual:Hooks/OutputPageMakeCategoryLinks doesn't seem related, it's the last thing I checked, but maybe you'll find something related [20:58:08] Hmmm, ResourceLoaderModule->getDependencies() overrides ResourceLoaderFileModule->getDependencies(), which is probably why I have been seeing empty array in my attempt at debugging [20:59:11] Isn't it the other way around? [20:59:19] class ResourceLoaderFileModule extends ResourceLoaderModule [21:25:38] Aha! I figured out now that onBeforePageDisplay `$wgOut->getModules()` shows the list of modules, and that onParserFirstCallInit doesn't yet have that processed [21:29:16] oh, and something I am doing is sorting the list of modules for some reason (I think I saw the code that does that too, but I don't know what the reason is) [21:30:08] includes/resourceloader/ResourceLoaderFileModule.php case 'dependencies' sort( $option ); [21:31:32] actually, nevermind [22:17:19] thanks for looking ryzenda