Extension talk:Cargo

Pins on Openlayers map not clickable on mobile
I can't get the pins on Openlayers maps to be clickable on mobile (or whatever the word is - touchable?). The same query with Google maps works all right. Jonathan3 (talk) 13:23, 9 January 2023 (UTC)


 * Any ideas? :-) Jonathan3 (talk) 22:42, 27 January 2023 (UTC)

Stripmarkers displayed in query output when using Template Styles Extension on wikitext field
We frequently use templates to inject additional information or styling into wikitext, some of which gets stored in the Cargo tables. When the styling is handled by Common.css, all behavior is normal. If the CSS is moved such that it's managed by the TemplateStyles extension, then the Cargo Query will begin to display Strip Markers in the output. How can this be resolved without moving styling back into Common.css?

I attempted to add a link to an example of this error, but Mediawiki would not allow me. 67.191.180.153 18:47, 10 January 2023 (UTC)


 * Do you mean that this error can be seen on a public wiki? If so, could you put the URL here without the "http" part? Yaron Koren (talk) 03:57, 11 January 2023 (UTC)
 * I set up a demo of the error here. The page is a query which displays a wikitext summary. Cargo behaved as intended in the past, but after introducing TemplateStyles, cargo now displays the stripmarkers for the wikitext fileds' template calls. www.dustloop.com/w/User:PrivateTarkus/sandbox 67.191.180.153 05:51, 12 January 2023 (UTC)
 * As a temporary solution, I've disabled Templatestyles for templates which frequently appear within Cargo fields. As expected, this workaround does resolve the issue for now. It seems to be a problem of cross-compatability between Templatestyles and Cargo, @Yaron Koren. 67.191.180.153 14:05, 16 January 2023 (UTC)

Sort from largest to smallest
Hello, how can I sort the rows in the table so that the table starts from 10 to 1, and not 1 to 10. I use Lua. -- Oleksii 212.80.47.83 07:47, 18 January 2023 (UTC)


 * Just add " DESC" at the end of the "order by" value. Yaron Koren (talk) 19:02, 18 January 2023 (UTC)

Compound Query ordering
Cargo 3.3.1

MW 1.39.0

Is it possible to set the Order by so that it affects all the queries in a compound query?

Example query

This has two queries, but the results are displayed in order for each individual query. Temujen510 (talk) 20:12, 21 January 2023 (UTC)


 * Unfortunately, no. Yaron Koren (talk) 01:22, 23 January 2023 (UTC)

Page references in columns not updated after moving page
What is the expected behavior for a Page data type in a Cargo column? I had expected that when I move a page, all references to that page in Cargo table columns would then be updated, but that doesn't appear to be happening. What is the best approach to keeping two tables, one of which references the other's page name, in sync after page moves? Nicholasalanbrown (talk) 02:08, 5 February 2023 (UTC)


 * No, what's in Cargo just reflects what's in the wikitext (well, usually). You can do something like joining on the _pageData table and using its _pageNameOrRedirect field, but I would recommend just using the Replace Text extension. Yaron Koren (talk) 03:27, 6 February 2023 (UTC)

Hide "Go to date" part of calendar
This part of the calendar doesn't look well when the screen is narrow. What is the best way to hide it? I see that one of the calendars linked to on the documentation page is https://icannwiki.org/IG_Hub/Calendar and it does not have the "Go to date" part. Thanks. Jonathan3 (talk) 08:25, 14 February 2023 (UTC)

Link do Drilldown
I am trying to put a link to a pre-filtered drilldown on a wiki page. The link looks fine when I hover over it, but I actually click on it the "&" and other special characters get changed. For example, instead of what it should be and is in the hover over  it becomes , and when I click on it I get an error. How would I build a link to a drilldown in a wiki page? Tenbergen (talk) 16:10, 15 February 2023 (UTC)


 * Right - the only solution I can think of is to make an external link (with the full "http..."), instead of an internal link. Yaron Koren (talk) 16:47, 15 February 2023 (UTC)


 * That works for explicit links, thanks! I was trying to generate the links inside a query (I have an aggregate query that provides counts, and want to link to a drilldown that would list the values that are counted). Some of the values have spaces in them, so the only way I can think of to make this work is to enable the "replace" function in SQL and then turn the spaces into "+" to generate the link. This works, but REPLACE seems to be an especially problematic function to enable. Is there a better solution to generate that link? Tenbergen (talk) 18:06, 15 February 2023 (UTC)
 * Oh, I see. That seems fine - I don't see anything wrong with using REPLACE. Yaron Koren (talk) 20:10, 15 February 2023 (UTC)


 * My concern with enabling the replace function was that it might allow re-writing things inside an SQL query, e.g. SQL injection. Maybe I am being paranoid. Tenbergen (talk) 19:17, 16 February 2023 (UTC)

"Recreate data" issue with Mediawiki 1.39.1
I'm getting the following error. I have ran update.php since upgrading Mediawiki and Cargo. Any ideas?

Error 1054: Unknown column 'tl_namespace' in 'where clause'

Function: SpecialCargoRecreateData::getNumPagesThatCallTemplate

Query: SELECT COUNT(*) AS total FROM `page`,`templatelinks` WHERE (tl_from=page_id) AND tl_namespace = 10 AND tl_title = 'CMTS'

Backtrace:

from /var/www/html/wiki/includes/libs/rdbms/database/Database.php(1618)


 * 1) 0 /var/www/html/wiki/includes/libs/rdbms/database/Database.php(1602): Wikimedia\Rdbms\Database->getQueryException


 * 1) 1 /var/www/html/wiki/includes/libs/rdbms/database/Database.php(1576): Wikimedia\Rdbms\Database->getQueryExceptionAndLog


 * 1) 2 /var/www/html/wiki/includes/libs/rdbms/database/Database.php(952): Wikimedia\Rdbms\Database->reportQueryError


 * 1) 3 /var/www/html/wiki/includes/libs/rdbms/database/Database.php(1708): Wikimedia\Rdbms\Database->query


 * 1) 4 /var/www/html/wiki/includes/libs/rdbms/database/DBConnRef.php(103): Wikimedia\Rdbms\Database->select


 * 1) 5 /var/www/html/wiki/includes/libs/rdbms/database/DBConnRef.php(325): Wikimedia\Rdbms\DBConnRef->__call


 * 1) 6 /var/www/html/wiki/extensions/Cargo/includes/specials/SpecialCargoRecreateData.php(164): Wikimedia\Rdbms\DBConnRef->select


 * 1) 7 /var/www/html/wiki/extensions/Cargo/includes/specials/SpecialCargoRecreateData.php(79): SpecialCargoRecreateData->getNumPagesThatCallTemplate


 * 1) 8 /var/www/html/wiki/extensions/Cargo/includes/CargoRecreateDataAction.php(43): SpecialCargoRecreateData->execute


 * 1) 9 /var/www/html/wiki/includes/MediaWiki.php(542): CargoRecreateDataAction->show


 * 1) 10 /var/www/html/wiki/includes/MediaWiki.php(322): MediaWiki->performAction


 * 1) 11 /var/www/html/wiki/includes/MediaWiki.php(904): MediaWiki->performRequest


 * 1) 12 /var/www/html/wiki/includes/MediaWiki.php(562): MediaWiki->main


 * 1) 13 /var/www/html/wiki/index.php(50): MediaWiki->run


 * 1) 14 /var/www/html/wiki/index.php(46): wfIndexMain


 * 1) 15 {main} Brian Coulter (talk) 05:36, 16 February 2023 (UTC)


 * Please make sure you're using version 3.3.1 or higher of Cargo. Yaron Koren (talk) 13:39, 16 February 2023 (UTC)
 * Sure enough, I was on version 3.2. I thought I was on the latest version.  Thank you. Brian Coulter (talk) 15:28, 16 February 2023 (UTC)

Error using Display Format Tree
I have a query that uses format=tree. The query works fine with default format, but when it includes the tree format I get An error occurred while attempting to preview your changes. [Y@6B0PewgK-G5pKpZ7wu1AAAAA8] Caught exception of type TypeError When I enable debug, it gives [Y@0OWaDWU8Gc8kr4BU0dggAAAA8] /index.php?title=Org_Chart&action=submit TypeError: array_key_exists: Argument #2 ($array) must be of type array, CargoFieldDescription given Backtrace: from /.../extensions/Cargo/includes/formats/CargoTreeFormat.php(40) This CargoTreeFormat.php(40) is if ( array_key_exists( 'isList', $fieldDescriptions[$this->mParentField] ) ) { What is actually wrong here? I think an exception isn't being trapped as intended, but I don't understand what. What do I need to change? Tenbergen (talk) 19:23, 16 February 2023 (UTC)


 * Wow! It must have been a long time since anyone tried to use the "tree" format, because there were various things that were not working there - that "isList" check was just one of them. I just checked in a fix, so it all should work better. Yaron Koren (talk) 21:37, 16 February 2023 (UTC)


 * That fixed it! Yes, it's been a problem for a long time, I just had not got back to troubleshooting it. Thanks! Tenbergen (talk) 00:12, 17 February 2023 (UTC)

Add table row [edit link] when using format=template
I'm displaying results in a table, using format=template for the rows. How can I add a Page Forms edit link next to each row? I know this is possible using format=table by adding the parameter "edit link=yes", but I haven't figured out how to do it when using format=template. Note that I'm using unique numbers as the pagename for each country.

Template:Country

Template:Country row









Template:List of countries

120.28.64.1 09:23, 19 February 2023 (UTC)


 * It sounds like you need to add _pageName to the list of fields in the query - and then have #formlink include . Yaron Koren (talk) 16:09, 20 February 2023 (UTC)