Extension talk:Cargo

Magic Words and Fields
I'm using CONCAT in  to take one database field and construct some special wikitext before it displays. I do need to use magic words which is causing an issue I can't resolve.

As a simple test  works fine with the "r" in "Actor" converting to an "x" to make "Actox".

However, if I had add a database field it no longer works. . Role.position returns "Actor", and even with the magic word conversion, it still returns "Actor" instead of "Actox". 70.160.223.43 11:53, 12 August 2023 (UTC)


 * I would recommend doing the whole thing within SQL, i.e. using the function REPLACE instead of creating a call to #replace - that should work better, if I understand what you're trying to do correctly. Yaron Koren (talk) 13:08, 15 August 2023 (UTC)
 * You can escape curly braces by creating templates that return 🇦🇩, e.g: Template:(( that contains  and a matching Template:))  which you then call like   to get a working template Ivlvlvllvlvlvlvlvlvl (talk) 13:50, 2 September 2023 (UTC)
 * That is a really useful comment, thanks. I wish I'd thought of that years ago. Jonathan3 (talk) 22:23, 2 September 2023 (UTC)

Store a different boolean value
How to I store a different value than "Yes" or "No" in the Cargo table when using a checkbox in Page Forms? I thought adding something like to #cargo_store in the template would do it, but I still see Yes or No values: |Test= Alternatively, can a different value be stored by adding parameters to the form itself? Tahoma403 (talk) 09:25, 2 September 2023 (UTC)


 * What do you want to do? If it's to display things as "first" or "second" then you could handle that in the template displaying the infobox/query. Jonathan3 (talk) 22:19, 2 September 2023 (UTC)
 * Don't ask me why, but I actually want to reverse the stored Yes or No values, so that an unchecked box stores Yes in the Cargo table and vice versa. I'm aware that I can query the data to display different values. Tahoma403 (talk) 04:38, 3 September 2023 (UTC)
 * Why are "first" and "second" in that call? Shouldn't it be "No" and "Yes"? Yaron Koren (talk) 12:24, 6 September 2023 (UTC)
 * Sorry, I put "first" and "second" to clarify that I wanted different values stored than the standard Yes or No, but in reality I want the reversed No/Yes for the checkbox/boolean entry. Neither first|second or No|Yes seem to work. Tahoma403 (talk) 13:20, 8 September 2023 (UTC)
 * I have no idea - that seems like it should work. Yaron Koren (talk) 15:09, 8 September 2023 (UTC)
 * I figured I needed to change the field type from Boolean to String to make it work. Tahoma403 (talk) 12:06, 9 September 2023 (UTC)

Queries fail depending on the order tables are listed
Testing the staging version of a wiki that will be upgraded from MW 1.37.2 and Cargo 3.0 to MW 1.40.0 and Cargo 3.4.1, we have come across an issue on the updated site where queries that were working are now failing. The cases l've encountered happen when you are joining 3 tables: if the primary table (the one included in both join clauses) is listed last, the query that is generated looks like ... ..., which fails with a sql error. If the primary table is listed first or second, you instead get a working query: ... ... Ivlvlvllvlvlvlvlvlvl (talk) 14:07, 2 September 2023 (UTC)


 * Handling of the "join on" order was improved a lot in the latest Cargo version, 3.4.3 - I would recommend upgrading to that one. Yaron Koren (talk) 00:58, 3 September 2023 (UTC)

Compound queries overall order
Hi everyone, I'm looking to make compound queries to output in the "template" format but for my application I need an overall order option, so the output of the two queries are mixed. Currently, the output is the output of the first query, followed by the output of the second query. Is it possible to change this? Thanks Garuda3 (talk) 15:36, 2 September 2023 (UTC)


 * Until you get a better answer - I think that recently I thought about this and concluded that it wasn't possible, as there are very few possible options outside the individual queries within #compound_query. I guess that it would be possible via a Lua/Scribunto module. Jonathan3 (talk) 22:22, 2 September 2023 (UTC)

Query showing each item of "List" field on separate row
If Field_A is a Cargo list field, could you do a query ending up with a table like this?

A     | Page ---+--- abc   | Page1 def   | Page1 xyx   | Page2 Jonathan3 (talk) 21:52, 13 September 2023 (UTC)


 * Sorry for asking too soon. I worked it out with #arraymap and the template output format. Jonathan3 (talk) 22:01, 13 September 2023 (UTC)
 * You could also do this by just directly querying the "field table", i.e. the table named MainTableName__FieldName. Yaron Koren (talk) 13:06, 14 September 2023 (UTC)

Dynamic Table format issues
When testing dynamic tables format, seems there's no way to disable "hidden fields" toggles and text, or is there? --There's no unique class around the toggle text, but there are for toggle links (I can hide part, not all). I had to wrap the query in a div (with a matching page background color) and then set a negative margin, to moving the dynamic table up/over the unwanted "hidden" field toggles, to truly hide them. This allows such columns to be searched on still (say if they contained keywords, or text for images/icons I don't want displayed in the table). Though this isn't ideal, as there's a flash of all content on load before it "hides".

I tried to move said fields under "details fields" instead, but these are unexpectedly not searchable, why? Further, specifying a field in "details fields" that's already been added to the "hidden" ones, removed it from "hidden fields" (now they're no longer searchable... which is an issue, though perhaps making these work together is problematic). I ended up having to double-specify the same fields in both places, with different names, to be both searchable and folded up below each record in bottom (+) section.

The above seems unituitive, to just move the cell value toggles from between record to below them... also while still having them searchable--and it all displays initially until full page load, creating a bit of a visual snarl. Is this the intended behaviour in either case? After a certain number of columns, it makes better sense to have fields below, rather than between, especially for mobile... however, they need to be searchable. FrozenPlum (talk) 01:31, 17 September 2023 (UTC)

I wish the DataTables maker had labelled toggle columns as "toggle columns" (accurately describing function), and that Cargo had an option for toggle label/link visibility. Further, it would be great for all fields to be searchable by default, with an optional field to exclude some as desired (it's unclear what the logic was behind the different functions of the two similar features, displayed in different locations).

Also, for the "details fields" fold out, if the data is from the same table all fields are confined to the first cell only, even though the fold-out is quite wide--the only exception to that is list data, which does a colspan and extend through all columns. I can see from other examples that maybe join data goes left to right, but same-table "more details" goes from top to bottom in a left-to-right layout.

Hopefully Yaron doesn't mind that I added to the docs a couple things I found the hard way:
 * "details fields" are not searchable (currently).
 * Only indexed fields can display in "details fields".

FrozenPlum (talk) 01:31, 17 September 2023 (UTC)


 * The fact that "details fields" are not searchable is definitely worth including in the documentation, yes. And you're right that the functionality of "dynamic tables" is generally constrained by whatever is in the DataTables JS library, for better or worse. What did you mean by "Only indexed fields can appear"? Is that the same as what's in the previous sentence in the documentation, "each such field must be included in the  parameter as well"? Yaron Koren (talk) 13:27, 18 September 2023 (UTC)
 * Thanks for confirming the first. For the second, no, fields of a type that are "unindexed" as listed here will not appear at all in the details fields drop down (these were specified in the "fields" parameter)... I could not get any "Wikitext" type (non-indexed) fields to appear in "details fields" fold-dowm, despite being included and successfully useable elsewhere in the same table. MW 1.39.4, Cargo 3.4.2. Php 8.0.28. FrozenPlum (talk) 10:50, 20 September 2023 (UTC)
 * Oh, you're talking about database indexing. I just tried a "dynamic table" query, and I was able to get a field of type Wikitext to display fine in "details fields", though. I don't know how much testing you did - you may well be seeing some sort of bug in the "dynamic table" handling, but I don't think it's related to the field types per se. Yaron Koren (talk) 12:51, 20 September 2023 (UTC)

Outdated API endpoints?
The list of API endpoints at Extension:Cargo/Other features lists 9 items, but my wiki's /api.php only lists 7 Cargo items. Have "cargofields" and "cargotables" been retired? I tried to use them, but they don't return any result. BrownKDocs (talk) 17:35, 20 September 2023 (UTC)


 * While I'm asking questions about the API-- what is the difference between "cargorecreatedata" and "cargorecreatetables"? It looks like "recreatedata" only works on one table at a time, but are they different beyond that? BrownKDocs (talk) 18:06, 20 September 2023 (UTC)
 * Some of these endpoints say they require a CSRF token, which should be requested using the "tokens" API parameter. However, the api.php page says "tokens" is deprecated. Will the Cargo API endpoints be updated if "tokens" gets removed? BrownKDocs (talk) 18:33, 20 September 2023 (UTC)
 * Hi -
 * It's the other way around, those are the newest Cargo API actions. You probably need to upgrade to a newer version of Cargo.
 * I believe "cargorecreatedata" recreates the tables and populates them, while "cargorecreatetables" only recreates the tables.
 * Are you talking about this? The use of tokens wasn't deprecated, just the way in which they're retrieved was (nine years ago). I believe Cargo is handling this correctly.
 * Yaron Koren (talk) 00:35, 21 September 2023 (UTC)
 * Thank you so much!!
 * Re #3, I'm running MW 1.35 and the "tokens" line on api.php says "Deprecated. Get tokens for data-modifying actions" -- but after reading the page you linked, I guess that's an unclear warning about the things that were removed in 2021. BrownKDocs (talk) 14:57, 21 September 2023 (UTC)

Embed "more results" page?
I have a page with a table limiting the query results to 50 rows. When clicking the "More..." link under the table, I want to load the next 50 results in the same page/table, keeping the page title and surrounding elements - instead of loading a Special page titled "Cargo query". Is this possible? Tahoma403 (talk) 14:34, 28 September 2023 (UTC)


 * No, but it's an interesting idea. Yaron Koren (talk) 19:37, 28 September 2023 (UTC)

Map display error in drilldown request
When querying locations through the Special:Drilldown page, the "list" format works well but the "leaflet" format displays a blank map. The error in the browser console is :

The Cargo declaration is :

Any idea on what is causing the error ? Emmanuel T. (talk) 12:02, 3 October 2023 (UTC)


 * Does the same problem happen with other map formats, do you know? Yaron Koren (talk) 17:36, 3 October 2023 (UTC)
 * When I replace "leaflet" with "openlayers" or "googlemaps" in the #cargo_declare, the drilldown is in error :
 * When I query the same table with #cargo_query the "leaflet" display works well. Emmanuel T. (talk) 10:41, 4 October 2023 (UTC)
 * Okay, thank you. My guess is that a value of simply  would work better for   - that might be the issue. Yaron Koren (talk) 12:34, 4 October 2023 (UTC)
 * I first used these values for fields, it causes the following DB query error :
 * (The tables prefix for this wiki is "isee")
 * That is why I used  instead of   Emmanuel T. (talk) 12:49, 4 October 2023 (UTC)
 * It's odd that you're getting that error message. I should have asked before: what version of Cargo are you running? Yaron Koren (talk) 13:02, 4 October 2023 (UTC)
 * Here are the data from Special:Version
 * Emmanuel T. (talk) 13:32, 4 October 2023 (UTC)
 * That's very odd. Could you try recreating the "expert" table? Maybe some old settings are still being stored there. Yaron Koren (talk) 13:48, 4 October 2023 (UTC)
 * You are right, Yaron, the issue comes from a bad formatting of coordinates in the table. Emmanuel T. (talk) 14:25, 5 October 2023 (UTC)
 * Okay, that's interesting. I'm glad you got it to work! Yaron Koren (talk) 14:59, 5 October 2023 (UTC)
 * Emmanuel T. (talk) 13:32, 4 October 2023 (UTC)
 * That's very odd. Could you try recreating the "expert" table? Maybe some old settings are still being stored there. Yaron Koren (talk) 13:48, 4 October 2023 (UTC)
 * You are right, Yaron, the issue comes from a bad formatting of coordinates in the table. Emmanuel T. (talk) 14:25, 5 October 2023 (UTC)
 * Okay, that's interesting. I'm glad you got it to work! Yaron Koren (talk) 14:59, 5 October 2023 (UTC)
 * Emmanuel T. (talk) 13:32, 4 October 2023 (UTC)
 * That's very odd. Could you try recreating the "expert" table? Maybe some old settings are still being stored there. Yaron Koren (talk) 13:48, 4 October 2023 (UTC)
 * You are right, Yaron, the issue comes from a bad formatting of coordinates in the table. Emmanuel T. (talk) 14:25, 5 October 2023 (UTC)
 * Okay, that's interesting. I'm glad you got it to work! Yaron Koren (talk) 14:59, 5 October 2023 (UTC)
 * You are right, Yaron, the issue comes from a bad formatting of coordinates in the table. Emmanuel T. (talk) 14:25, 5 October 2023 (UTC)
 * Okay, that's interesting. I'm glad you got it to work! Yaron Koren (talk) 14:59, 5 October 2023 (UTC)

cargo_store silently fails if string too long
Using


 * MediaWiki 1.39.5
 * PHP 8.1.24
 * MariaDB 10.6.12
 * Cargo 3.4.3

If you attempt to invoke #cargo_store and try to store a String that's longer than the field limit (default 300 characters) the query will silently fail and, more surprisingly, stop any subsequent cargo_stores from executing. The expected behaviour would be either (a) the too-long string is truncated or, (b) an error is logged. It would be appreciated if either a or b is implemented, or at least a note is written on the common problems or known bugs page.

- Skairunner (talk) 08:59, 17 October 2023 (UTC)

Getting link target and link text in the same query
So, I'm trying to make a template that generates a wikilink, where both the target page and the link text are different values in the Cargo database. But I haven't been able to find a way to get it to work.

I initially tried. This seemed to work just fine in Special:CargoQuery, but when I put it in an actual page there was no output at all.

So, then I tried splitting it like, but this results in something like &#91;&#91;Foo ( CONCAT("|", name, "&#93;&#93;"): |bar&#93;&#93;). I couldn't find any documentation for a way to change this multi-field formatting behavior to the way I want.

How do you actually do this? Saucy (talk) 03:37, 20 October 2023 (UTC)


 * The first one seems like it should work... maybe the string in the middle should be an actual pipe? Yaron Koren (talk) 17:49, 20 October 2023 (UTC)
 * I've tried it both ways; doesn't make a difference. I did figure out what the problem was though: I was performing the query through a template that automatically adds the "no html" parameter to the cargo query. Once I told it not to do that, it worked just fine! Saucy (talk) 21:20, 20 October 2023 (UTC)

Recreating table stops after 500 records
We recently needed to add a field to one of our tables. After adding the field, we tried to recreate the data for the table. The recreation seems to start out fine, but then it stops after creating 500 records in the table. Blinkingline (talk) 13:44, 24 October 2023 (UTC)


 * Do you see any JavaScript errors in the browser console? It would appear that the recreate process, which handles pages 500 at a time, is failing when it gets to the 2nd batch. Also, what version of Cargo are you running? Yaron Koren (talk) 13:53, 24 October 2023 (UTC)
 * Using Cargo 3.3.1 on MW 1.39.0. I do see this error in the console:
 * CardData?_replacement:1396 This page is using the deprecated ResourceLoader module "mediawiki.pager.tablePager". Deprecated in 1.38. Use `mediawiki.pager.styles` Blinkingline (talk) 14:01, 24 October 2023 (UTC)
 * Okay, thanks. That deprecation issue needs to be fixed, but it's not the reason for this error. You are using a somewhat old version of Cargo, though - there's a chance that whatever problem you are seeing has been fixed, so I would recommend upgrading to the most recent version. Yaron Koren (talk) 14:07, 24 October 2023 (UTC)
 * Sounds good. I'll update it and get back to you if there's still an issue. Thanks for your help, as always! Blinkingline (talk) 15:11, 24 October 2023 (UTC)
 * I believe I'm facing the same issue @Yaron Koren. I'm using MediaWiki 1.39.3 and Cargo extension 3.4.1. Every time I attempt to recreate a "replacement table" and run the runJobs.php script, I encounter the error "PHP Notice: Uncommitted DB writes (transaction from Wikimedia\Rdbms\Database::begin) in /var/www/wiki/includes/libs/rdbms/database/TransactionManager.php on line 583," and the table is never fully recreated with the total number of rows from the original 189.6.17.146 16:56, 24 October 2023 (UTC)
 * This sounds like a different sort of error. (I'm guessing your number of rows is never a round number like 500.) Could you try recreating the table(s) via the command-line script cargoRecreateData.php, and see if any error messages show up during the process? Yaron Koren (talk) 17:12, 24 October 2023 (UTC)
 * I tried to do that, but it's showing many errors.:
 * php cargoRecreateData.php --table NewsSources Recreating data for Cargo table NewsSources in 5 seconds... hit [Ctrl]-C to escape. Deleting and recreating table... Handling template that adds to this table: NewsSource Saving data for pages 1 to 500 that call this template... PHP Deprecated: Use of InternalParseBeforeSanitize hook (used in VariablesHooks::onInternalParseBeforeSanitize) was deprecated in MediaWiki 1.35. [Called from MediaWiki\HookContainer\HookContainer::run in /var/www/wiki/includes/HookContainer/HookContainer.php at line 137] in /var/www/wiki/includes/debug/MWDebug.php on line 381 PHP Deprecated:  Use of ParserOutput::addModuleStyles with non-array argument was deprecated in MediaWiki 1.38. [Called from {closure} in /var/www/wiki/LocalSettings.php at line 262] in /var/www/wiki/includes/debug/MWDebug.php on line 381 PHP Deprecated:  Use of ParserOutput::addModules with non-array argument was deprecated in MediaWiki 1.38. [Called from {closure} in /var/www/wiki/LocalSettings.php at line 263] in /var/www/wiki/includes/debug/MWDebug.php on line 381 Wikimedia\Rdbms\DBQueryError from line 1618 of /var/www/wiki/includes/libs/rdbms/database/Database.php: Error 1406: Data too long for column 'url' at row 1 Function: Wikimedia\Rdbms\Database::insert Query: INSERT INTO `wiki_cargo__NewsSources` (`source`,`url`,`_pageName`,`_pageTitle`,`_pageNamespace`,`_pageID`,`_ID`) VALUES ('Twitter','https://twitter.com/NKT_Esports/status/1665724427147812864?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1665724427147812864%7Ctwgr%5E9fa3d560c637e2dea3bcf589075d7e178781045c%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Fdotesports.com%2Fcounter-strike%2Fnews%2Fcsgo-pro-admits-to-committing-fraud-against-his-own-teammates','News/CS:GO Pro Confessed Fraud','News/CS:GO Pro Confessed Fraud',0,1718,21)
 * 0 /var/www/wiki/includes/libs/rdbms/database/Database.php(1602): Wikimedia\Rdbms\Database->getQueryException('Data too long f...', 1406, 'INSERT INTO `wi...', 'Wikimedia\\Rdbms...')
 * 1 /var/www/wiki/includes/libs/rdbms/database/Database.php(1576): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('Data too long f...', 1406, 'INSERT INTO `wi...', 'Wikimedia\\Rdbms...')
 * 2 /var/www/wiki/includes/libs/rdbms/database/Database.php(952): Wikimedia\Rdbms\Database->reportQueryError('Data too long f...', 1406, 'INSERT INTO `wi...', 'Wikimedia\\Rdbms...', false)
 * 3 /var/www/wiki/includes/libs/rdbms/database/Database.php(1838): Wikimedia\Rdbms\Database->query('INSERT INTO `wi...', 'Wikimedia\\Rdbms...', 128)
 * 4 /var/www/wiki/extensions/Cargo/includes/CargoUtils.php(1207): Wikimedia\Rdbms\Database->insert('NewsSources', Array)
 * 5 /var/www/wiki/extensions/Cargo/includes/parserfunctions/CargoStore.php(439): CargoUtils::escapedInsert(Object(Wikimedia\Rdbms\DatabaseMysqli), 'NewsSources', Array)
 * 6 /var/www/wiki/extensions/Cargo/includes/parserfunctions/CargoStore.php(167): CargoStore::storeAllData(Object(Title), 'NewsSources', Array, Object(CargoTableSchema))
 * 7 /var/www/wiki/includes/parser/Parser.php(3443): CargoStore::run(Object(Parser), Object(PPTemplateFrame_Hash), Array)
 * 8 /var/www/wiki/includes/parser/Parser.php(3126): Parser->callParserFunction(Object(PPTemplateFrame_Hash), 'cargo_store', Array)
 * 9 /var/www/wiki/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution(Array, Object(PPTemplateFrame_Hash))
 * 10 /var/www/wiki/includes/parser/Parser.php(3317): PPFrame_Hash->expand(Object(PPNode_Hash_Tree))
 * 11 /var/www/wiki/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution(Array, Object(PPFrame_Hash))
 * 12 /var/www/wiki/includes/parser/PPTemplateFrame_Hash.php(178): PPFrame_Hash->expand(Object(PPNode_Hash_Tree), 4)
 * 13 /var/www/wiki/includes/parser/PPTemplateFrame_Hash.php(190): PPTemplateFrame_Hash->getNamedArgument('sources')
 * 14 /var/www/wiki/includes/parser/Parser.php(3923): PPTemplateFrame_Hash->getArgument('sources')
 * 15 /var/www/wiki/includes/parser/PPFrame_Hash.php(293): Parser->argSubstitution(Array, Object(PPTemplateFrame_Hash))
 * 16 /var/www/wiki/extensions/WikiSEO/includes/WikiSEO.php(451): PPFrame_Hash->expand(Object(PPNode_Hash_Tree))
 * 17 /var/www/wiki/includes/parser/Parser.php(3443): MediaWiki\Extension\WikiSEO\WikiSEO::fromParserFunction(Object(Parser), Object(PPTemplateFrame_Hash), Array)
 * 18 /var/www/wiki/includes/parser/Parser.php(3126): Parser->callParserFunction(Object(PPTemplateFrame_Hash), 'seo', Array)
 * 19 /var/www/wiki/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution(Array, Object(PPTemplateFrame_Hash))
 * 20 /var/www/wiki/includes/parser/Parser.php(3317): PPFrame_Hash->expand(Object(PPNode_Hash_Tree))
 * 21 /var/www/wiki/includes/parser/PPFrame_Hash.php(276): Parser->braceSubstitution(Array, Object(PPFrame_Hash))
 * 22 /var/www/wiki/includes/parser/Parser.php(2955): PPFrame_Hash->expand(Object(PPNode_Hash_Tree), 0)
 * 23 /var/www/wiki/includes/parser/Parser.php(1610): Parser->replaceVariables('{{News\n|seo_tit...')
 * 24 /var/www/wiki/includes/parser/Parser.php(724): Parser->internalParse('{{News\n|seo_tit...')
 * 25 /var/www/wiki/extensions/Cargo/includes/CargoUtils.php(576): Parser->parse('{{News\n|seo_tit...', Object(Title), Object(ParserOptions))
 * 26 /var/www/wiki/extensions/Cargo/maintenance/cargoRecreateData.php(181): CargoUtils::parsePageForStorage(Object(Title), '{{News\n|seo_tit...')
 * 27 /var/www/wiki/extensions/Cargo/maintenance/cargoRecreateData.php(75): CargoRecreateData->recreateAllDataForTable('NewsSources', false)
 * 28 /var/www/wiki/maintenance/includes/MaintenanceRunner.php(309): CargoRecreateData->execute
 * 29 /var/www/wiki/maintenance/doMaintenance.php(85): MediaWiki\Maintenance\MaintenanceRunner->run
 * 30 /var/www/wiki/extensions/Cargo/maintenance/cargoRecreateData.php(190): require_once('/var/www/wiki/m...')
 * 31 {main}
 * PHP Notice: Uncommitted DB writes (transaction from Wikimedia\Rdbms\Database::begin) in /var/www/wiki/includes/libs/rdbms/database/TransactionManager.php on line 583 189.6.17.146 04:20, 26 October 2023 (UTC)
 * That's very helpful, thank you. Those first set of deprecation notices aren't coming from Cargo, I don't think - at least one is from the Variables extension. But the key error message here is . I assume the "url" column is of type "URL", whose default maximum size is 300 characters - and this URL is about 320 characters long. Cargo should not be crashing on that, but regardless, the best fix for you would be to increase the size of that column, with something like   in #cargo_declare. (Or, alternatively, just remove some unnecessary stuff from that URL, if this is a unique case.) Yaron Koren (talk) 13:20, 26 October 2023 (UTC)
 * Thank you for your response, @Yaron Koren! We managed to resolve the key error, but now we encounter an issue where creating a replacement table gets stuck at 500 189.6.17.146 22:24, 27 October 2023 (UTC)
 * We encountered the same error as the person above. From the console, we can see this message: 'This page is using the deprecated ResourceLoader module "mediawiki.pager.tablePager." Deprecated in 1.38. Please use 'mediawiki.pager.styles' 189.6.17.146 22:36, 27 October 2023 (UTC)
 * That's too bad that you are seeing the same problem. I don't know why you are both getting this - my guess is that the API action is failing somehow when the "offset" parameter is applied. For not, you both might be better off calling cargoRecreateData.php for that table, rather than doing it from the web interface. Yaron Koren (talk) 16:41, 30 October 2023 (UTC)

Calendar not displaying events
I have copied the source code for a calendar and events from the DiscourseDB example. I tried to add them here, but had difficulty - I've literally copy and pasted the examples shown there into my wiki with the same page names. The Items table is populated with the event page's data; however, the calendar does not display the event.

Potentially relevant symptoms
108.203.6.24 15:13, 31 October 2023 (UTC)
 * The event is visible if the format is set to table
 * I receive an internal server error if I set the format to a timeline
 * Setting the format to a CSV or icalendar yields no results
 * I've noticed that the Items table on DiscourseDB stores dates in the MM dd, YYYY format, whereas my wiki stores dates in the YYYY-mm-dd format (mine is clearly better)
 * There is an error message on the event page about the Items_reference table not existing
 * This struck me as irrelevant
 * Apache HTTP has no relevant error logs


 * What do the #cargo_declare and #cargo_query calls look like? Yaron Koren (talk) 17:13, 31 October 2023 (UTC)
 * I had tried to copy them earlier but wasn't able to due to links. Here are those calls isolated:
 * 108.203.6.24 17:43, 31 October 2023 (UTC)
 * I had previously been receiving an internal server error when using the recurring event method, which I fixed by enabling the calendar extension in php.ini (Arch Linux). Unfortunately, I am still receiving errors on timelines and the calendar still does not display events. 108.203.6.24 12:27, 1 November 2023 (UTC)
 * Going a bit in the weeds here, I noticed the following in the HTML for a calendar:
 * CSV, iCalendar, and Calendars all use the page Special:CargoExport and all return no data. At least by looking at the HTML, a Cargo Table does not use this page. It seems my issue is with CargoExport. 108.203.6.24 12:37, 1 November 2023 (UTC)
 * Playing around with the page Special:CargoQuery, I was able to see that the event is being captured by the cargo query, but is not being displayed on the calendar itself. With an event that exists in the future, I can set the where parameter to   or   to see 1 vs 0 results.  Both display an empty calendar. 108.203.6.24 12:48, 1 November 2023 (UTC)
 * After fruitlessly tailing the Apache error log, I found the separate MediaWiki error log:
 * I am going to try dropping the events table and building from scratch, then creating a new event table with a single date field for testing. 108.203.6.24 18:09, 1 November 2023 (UTC)
 * still nothing... 108.203.6.24 18:24, 1 November 2023 (UTC)
 * Here is what I would recommend: in the browser, open the console and go to the "Network" tab (or whatever it's called in that browser). Then in the calendar, go to the month that should be displaying data. Once you do, a new line should appear in that tab. Right-click on it to open that URL in a new tab, and please let me know what you see on that page. Yaron Koren (talk) 23:11, 1 November 2023 (UTC)
 * It is a CargoExport query. The page loads but nothing is displayed.  I've listed some other symptoms this feature is presenting above - ultimately I think CargoExport is in some way malfunctioning... 2600:1700:760:2120:D6D2:52FF:FE6E:732D 11:46, 2 November 2023 (UTC)
 * Actually, pulling up the console (Firefox), MediaWiki is returning a 500 on the CargoExport endpoint. Currently investigating. 2600:1700:760:2120:D6D2:52FF:FE6E:732D 11:56, 2 November 2023 (UTC)
 * Enabling php errors revealed this:
 * I am using php version 8.2.12. 108.203.6.24 15:27, 2 November 2023 (UTC)
 * Yikes. I tried changing   to   in   (which does not exist in the repositories?) and have a new error:
 * No idea if I'm moving in the right direction here - at this point it might be better to just use webdav... 108.203.6.24 15:52, 2 November 2023 (UTC)
 * Interestingly,  displays the same errors (both before and after the change, though they cause a failure on the latter). 108.203.6.24 15:59, 2 November 2023 (UTC)
 * Oh - I should have asked this before, but what versions of MediaWiki and Cargo are you running? Yaron Koren (talk) 16:30, 2 November 2023 (UTC)
 * I am using MediaWiki 1.40.1-1 and Cargo REL1_40-b3df937, though I think those php errors are a red herring as they appear on every page when the debug settings are enabled. Worth looking into, but not the root cause here. 108.203.6.24 17:37, 2 November 2023 (UTC)
 * Well, I think most or all of those error messages would go away if you switched to the latest Cargo version. (The "REL" branches of Cargo should generally be avoided.) But you're right that those might not be the issue. Yaron Koren (talk) 23:31, 2 November 2023 (UTC)
 * No idea if I'm moving in the right direction here - at this point it might be better to just use webdav... 108.203.6.24 15:52, 2 November 2023 (UTC)
 * Interestingly,  displays the same errors (both before and after the change, though they cause a failure on the latter). 108.203.6.24 15:59, 2 November 2023 (UTC)
 * Oh - I should have asked this before, but what versions of MediaWiki and Cargo are you running? Yaron Koren (talk) 16:30, 2 November 2023 (UTC)
 * I am using MediaWiki 1.40.1-1 and Cargo REL1_40-b3df937, though I think those php errors are a red herring as they appear on every page when the debug settings are enabled. Worth looking into, but not the root cause here. 108.203.6.24 17:37, 2 November 2023 (UTC)
 * Well, I think most or all of those error messages would go away if you switched to the latest Cargo version. (The "REL" branches of Cargo should generally be avoided.) But you're right that those might not be the issue. Yaron Koren (talk) 23:31, 2 November 2023 (UTC)
 * Well, I think most or all of those error messages would go away if you switched to the latest Cargo version. (The "REL" branches of Cargo should generally be avoided.) But you're right that those might not be the issue. Yaron Koren (talk) 23:31, 2 November 2023 (UTC)

Parser lock fails on "More..." results
Have a page that presents properly though all the template shenagginins I had to work though to get what I want. But when I click through for more results certain portions fail on parser locks:

Parser state cleared while parsing. Did you call Parser::parse recursively? Lock is held by: #0 /var/www/mediawiki-1.35.11/w/includes/parser/Parser.php(621): Parser->lock


 * 1) 1 /var/common/extensions/1.35/Cargo/includes/CargoUtils.php(543): Parser->parse
 * 2) 2 /var/common/extensions/1.35/Cargo/includes/formats/CargoTemplateFormat.php(83): CargoUtils::smartParse
 * 3) 3 /var/common/extensions/1.35/Cargo/includes/CargoQueryDisplayer.php(391): CargoTemplateFormat->display
 * 4) 4 /var/common/extensions/1.35/Cargo/includes/CargoQueryPage.php(191): CargoQueryDisplayer->displayQueryResults
 * 5) 5 /var/www/mediawiki-1.35.11/w/includes/specialpage/QueryPage.php(736): CargoQueryPage->outputResults
 * 6) 6 /var/common/extensions/1.35/Cargo/includes/specials/SpecialCargoQuery.php(36): QueryPage->execute
 * 7) 7 /var/www/mediawiki-1.35.11/w/includes/specialpage/SpecialPage.php(600): SpecialCargoQuery->execute
 * 8) 8 /var/www/mediawiki-1.35.11/w/includes/specialpage/SpecialPageFactory.php(635): SpecialPage->run
 * 9) 9 /var/www/mediawiki-1.35.11/w/includes/MediaWiki.php(307): MediaWiki\SpecialPage\SpecialPageFactory->executePath
 * 10) 10 /var/www/mediawiki-1.35.11/w/includes/MediaWiki.php(947): MediaWiki->performRequest
 * 11) 11 /var/www/mediawiki-1.35.11/w/includes/MediaWiki.php(547): MediaWiki->main
 * 12) 12 /var/www/mediawiki-1.35.11/w/index.php(53): MediaWiki->run
 * 13) 13 /var/www/mediawiki-1.35.11/w/index.php(46): wfIndexMain
 * 14) 14 {main}

AahzKarrde (talk) 20:03, 7 November 2023 (UTC)


 * What versions of Cargo and MediaWiki are you running? Yaron Koren (talk) 20:35, 7 November 2023 (UTC)
 * MediaWiki	1.35.11
 * Cargo	3.2 (d5db9a5) 07:54, 7 September 2022
 * I'm on a managed site, so I don't have control over these versions. AahzKarrde (talk) 12:45, 8 November 2023 (UTC)
 * Those versions seem fine. Does that error happen every time you load that Special:CargoQuery page? Yaron Koren (talk) 13:39, 8 November 2023 (UTC)
 * Yes, I ca make all the edits on the main page I want, shorten or lengthen the number of results from the query and everything displays fine. Once I click More I receive that list of errors in each item that goes through the templates I added.  I can't post the link here, but you can see this live at the following
 * site: swuholocron . com
 * path: /wiki/User:AahzKarrde/ParseLockFail AahzKarrde (talk) 13:58, 8 November 2023 (UTC)
 * Oh, it's a public wiki - that makes things a lot easier. (Here is the page.) So, there's a lot going on here: the query this page calls uses the DispTran2 template, which itself also calls #cargo_query, as well as calling four other templates - CardsInTopics, DisplayMainCard, GetMainCardImage and ShowCardsOrTransmissionIcon - all of which themselves also call #cargo_query. In theory, that should all still work, although it's very elaborate. The issue might be the GetMainCardImage template, whose query also uses the "template" format (with the template DisplayMainCardImage, which thankfully does not call a query). But my guess is that that chain of two template queries is causing parsing problems, though in theory Cargo should support it.
 * Regardless, though, this is a complex setup you have. Is there any way to simplify it? One option is to have the DispTran2 template simply call a Lua module, which handles all the remaining querying and display. I see that your wiki does have Scribunto installed. Yaron Koren (talk) 15:53, 8 November 2023 (UTC)
 * I'm certainly open to suggestions for simplification. This was me hacking together to get things to work.  If it didn't work on the top level I wouldn't have batted an eye and dug around for something else, it jsut that it broke at the subsequent level that bothered me.
 * I've confirmed Scribunto works. I'll start digging through that to see if I can simply the stack. AahzKarrde (talk) 16:08, 8 November 2023 (UTC)

Incorrect parameter count in call to native function
I have a query calling (which has been properly added to the allowlist of functions), but it only properly functions when I pass in 2 parameters. If I attempt to pass in 3, or 4, or 5 (the last 3 of which are optional in the MySQL spec), I get the following error:

Error 1582: Incorrect parameter count in the call to native function 'REGEXP_SUBSTR' (wiki_db)

This and other functions are pretty useless if they're not used with their optional parameters. Is this a bug, or is there some other way I'm supposed to invoke native functions with optional params? Teltura01 (talk) 23:24, 17 November 2023 (UTC)


 * I don't know if this is a Cargo issue, or an issue with your installation of MySQL. Do you have direct access to the database, and if so, could you try calling a SELECT statement there with REGEXP_SUBSTR, to see what it allows? Yaron Koren (talk) 14:08, 20 November 2023 (UTC)

WITHIN statement error when a Hierarchy item has an apostrophe
I first posted about this some months ago: I have a hierarchy definition in a template that includes the item "St. Mary's Anglican Church". When I try to query this with a WITHIN statement, I get an error that appears to split the query at the apostrophe. At the @Yaron Koren confirmed that this is a bug. As far as I can tell this has not been fixed. I have tried to have a look at the code but the regular expressions are boggling my mind a bit. Would someone else be able to fix this? Tenbergen (talk) 01:45, 28 November 2023 (UTC)


 * Hi, I'm not sure if this is the place to put this but I am running into the same problem. Any fix or workaround is appreciated! 206.45.51.2 02:59, 28 November 2023 (UTC)
 * I haven't found a solution, but looking through the code it appears they had realized the "other quote" problem in Cargoutils.php line 305. But I have no idea how I would use the solution from that spot for the WITHIN problem.Tenbergen (talk) 04:08, 28 November 2023 (UTC)