Extension talk:Cargo

[ANSWERED] MySQL/MariaDB database user privileges required by Cargo
I know that the normal thing to do is GRANT ALL PRIVILEGES, but I'm thinking of reducing that and would like to know which privileges are required by Cargo for (a) the main database and (b) its own Cargo database. See Topic:Wnht96uupemgrsef. Thanks. Jonathan3 (talk) 11:55, 5 January 2022 (UTC)


 * For the main DB, no special privileges. For the Cargo DB, probably just the ones you listed (SELECT, INSERT, UPDATE, LOCK TABLES, DELETE), plus CREATE TABLE. Yaron Koren (talk) 21:16, 5 January 2022 (UTC)


 * Thanks. I will try this out eventually. I guess that nobody bothers with this and database rights have never been a concern. Jonathan3 (talk) 10:39, 3 February 2022 (UTC)

Datatype "Monolingual text"
Hello,

Does an equivalent to SMW Datatype "Monolingual text" exist with Cargo ?


 * No... would it be useful? Yaron Koren (talk) 15:14, 10 January 2022 (UTC)

The need is to change the field label like in This is a property of type Has type::Text.

Language labels: Has preferred property label::Role@en Has preferred property label::Rolle@de


 * Where is that "Has preferred property label" property used? Yaron Koren (talk) 20:25, 11 January 2022 (UTC)

There is a description at "www.semantic-mediawiki.org/wiki/Help:Special_property_Has_preferred_property_label#Example"


 * I've seen that page before, but I don't really understand it - it doesn't seem to explain what the actual effect on the display, or user interface, is. Where in the interface is the "preferred property label" used? Yaron Koren (talk) 18:38, 13 January 2022 (UTC)

Table created, nothing stored, no matter via calling template or directly calling parser function
The table "Level" holds no data, however, the multiple pages has already called templates that store data. Directly calling  also does not work. I tried re-creating the table, or deleting and creating the table again, neither of which can fix. -- SolidBlock (talk) 09:28, 12 January 2022 (UTC)


 * Where is the actual #cargo_store call? The one right in that template is commented out. Yaron Koren (talk) 14:47, 12 January 2022 (UTC)
 * I undid the comment in that template. Besides, this page manually calls  however the data “Level” is still empty. SolidBlock (talk) 03:35, 13 January 2022 (UTC)


 * After uncommenting #cargo_store, I think you just need to recreate the table - you can do that from Special:CargoTables. Yaron Koren (talk) 15:31, 13 January 2022 (UTC)
 * However, unfortunately, no matter how many times I recreate the table, the issue is not fixed. And pages storing that data has no data shown to be stored in the "?action=pagevalues" page. -- SolidBlock (talk) 08:27, 14 January 2022 (UTC)
 * Are you sure that #cargo_store is actually getting called? It's inside a rather complicated #ifeq statement, and I'm not sure if it ever gets called. Yaron Koren (talk) 13:43, 14 January 2022 (UTC)
 * Yes. It works normally before I initially recreate the table. Besides, I manually called  in my sandbox page. It does not work, while another table works normally. SolidBlock (talk) 06:22, 15 January 2022 (UTC)
 * Could the reason be the exception of the replace table? Zes M Young (talk) 12:06, 19 January 2022 (UTC)

and another issue related to this
The following Lua throws MW internal exceptions, which began in recent days: SolidBlock (talk) 14:42, 21 January 2022 (UTC)


 * Maybe that's related. What are the exceptions? Yaron Koren (talk) 16:56, 21 January 2022 (UTC)
 * [993445ad01d110ae8272c772] 2022-01-22 14:07:00: Fatal exception of type "TypeError" -- SolidBlock (talk) 14:07, 22 January 2022 (UTC)
 * Could you please add  to your LocalSettings.php file? That will hopefully lead to a more useful error message. Yaron Koren (talk) 16:04, 24 January 2022 (UTC)
 * I have no permission to do that and have filed a task on miraheze phab. You may refer to it. SolidBlock (talk) 10:10, 25 January 2022 (UTC)

Sort by date in Special:Drilldown
Is it possible to do this? I've tried using  to the template but to no avail. Any ideas? Thanks. Jonathan3 (talk) 11:59, 13 January 2022 (UTC)

Just to clarify, I know the table is sortable - I just wondered whether there is a way to set a default sort column. Thanks. Jonathan3 (talk) 15:55, 13 January 2022 (UTC)

Exhibit display format supported?
Creating a query with display format exhibit results in a table of rows of headers only, though with proper itemid labels (i.e. pulled from the data). I am pulling from one table, one field only, with cargo data format = page. Display and source code contains none of the query data, though the export/toolbox widget button contains the data as expected. Multiple "Error: Missing property ID at position 1" js errors.

Is the Exhibit display format still maintained, or do I have something missing in my query? --JStallings29 (talk) 20:30, 16 January 2022 (UTC)


 * That works fine for me - what versions of MediaWiki and Cargo are you running? Yaron Koren (talk) 01:36, 17 January 2022 (UTC)
 * MW 1.37.1, Cargo 3.0 JStallings29 (talk) 01:56, 21 January 2022 (UTC)

Duplicate rows again, but this time only in Special:Drilldown
I have a List of String. Most pages have one value for that field, but some have two.

On the drilldown page, when I select two values as filters, any page with those two values is listed twice. The drilldown page works correctly in other respects and Special:CargoTables doesn't show any duplicate rows.

This is on Cargo 3.0 (07f465d) and MW 1.35.5. I've not noticed the same thing on a MW 1.34.4 wiki and Cargo 3.0 (55f3f72). Jonathan3 (talk) 12:19, 17 January 2022 (UTC)


 * If it helps, a page which matches three selected values on one filter field is displayed three times (ie on three rows). I guess this would apply to any number. Jonathan3 (talk) 10:37, 3 February 2022 (UTC)


 * I've downloaded the latest code today and it's still happening. Maybe it's something simple that I've missed. Jonathan3 (talk) 22:59, 12 February 2022 (UTC)

Query File column without HTML
Hi, first of all, this extension is awesome and makes our life really easy.

I have a column with the Type File which I query for a single File. Is it now possible to get the Image without the HTML surrounding's because I'd only need the filename, like it is stored? I would really like to keep the type of the column on file because of the nice view in the table view.

Thank's for getting back to me.

EDIT: I have found a solution. If I use format=template and just output the value, it work's fine. But if there is another, better solution, I'd be happy to hear from it. --DesignerThan (talk) 23:49, 30 January 2022 (UTC)


 * That's great! One semi-hack you can do is replace FieldName in the "fields=" parameter with CONCAT(FieldName) - then it will be interpreted as type String and not File. Yaron Koren (talk) 15:55, 31 January 2022 (UTC)

Display Format: Dynamic Table with hidden fields
Hi, I have encountered another thing, I don't know how to deal with it. Just wanted to use a query with format set to dynamic table where I want to use hidden fields. The thing now is, that it seem's so that only the last column can be set to hidden... I have this query here on a public wiki.

If someone could help me with it, that would be great. --DesignerThan (talk) 02:05, 3 February 2022 (UTC)


 * Sorry for the delay. I just tried "hidden fields=", and it works fine for me. What specifically are you trying to do, that isn't working? Yaron Koren (talk) 02:30, 18 February 2022 (UTC)

Scribunto : Empty fields missing in mw.ext.cargo.query results table
Hello, I am upgrading my installation from Mediawiki/Cargo 1.35.1/2.7.1 to 1.37.1/3.1.

I am using scribunto for a Cargo query. If I display the resulting table, I see that in the old version, the table has the same number of elements as fields in the Cargo query, whereas in the new version, fields with an empty value do not appear in the result table. Is there a way to get the same behaviour as before?

Best, --Ludovic Strappazon (talk) 16:39, 7 February 2022 (UTC)

Display Format: Dynamic Table with column widths
Hello, thanks for the new features in 3.1, in special "column widths" for dynamic tables. I just updated to. I always get an error when I try to set a value for the first column other than empty (i.e. before the first comma). The error seems to come of the library. Tested it on different tables with different number of columns.

And a second "error" or strange behavior I noticed: This setting for column widths acts on every cargo_query on a page and not only the one, where I added that parameter.

Brabi81 (talk) 07:38, 11 February 2022 (UTC)


 * Sorry about these problems; I believe they're both fixed now, in the latest Cargo code. Yaron Koren (talk) 14:40, 22 February 2022 (UTC)
 * Great! Just updated to the most recent version and everything I tested right now works without errors. Thank you. Brabi81 (talk) 11:58, 23 February 2022 (UTC)

Is Cargo right for this use case?
I'm hoping to use Cargo, but it's not clear to me from the docs I've read here whether or not it's appropriate for my use case. Specifically, at least in some cases, I do not want the typical user to be able to insert new records into the DB (or update or delete existing ones). From the docs, it seems like if I install Cargo and define Cargo table declarations within the wiki, then anyone with permission to edit or create a wiki page can just put cargo_attach and cargo_store calls into some random page, and voila, new database records.

Am I misunderstanding? If not, is there some way to prevent this, short of not letting users edit wiki pages, making the underlying DB read only, or things of that nature? For example, maybe there are $wg settings to define related permissions? I see there's one for create/recreate table, but I didn't see one for create/update records. -Rwv37 (talk) 04:06, 16 February 2022 (UTC)


 * I'm not sure I understand the question. Let's say that there's a template, "Person", which stores to a Cargo table called "People". If a regular user creates a new page that calls that "Person" template, should that page's data not be stored in the Cargo table? If so, when should that data get added to the table? Yaron Koren (talk) 04:28, 16 February 2022 (UTC)
 * Essentially, at least in some cases, what I want Cargo for is to pull data out of a database and easily use it in a wiki. Normal users would be able to use things like cargo_query to do whatever they want with the data, but they would not be able to use things like cargo_store to do whatever they want to the data. -Rwv37 (talk) 04:34, 16 February 2022 (UTC)
 * And to more specifically answer your actual questions: No, the typical user should not be able to insert data into the database, no matter whether through Cargo or otherwise. As for what should get data added to the table: Doesn't really matter, as long as only privileged users can do it. If there's a way to accomplish that in Cargo without allowing unprivileged users to do it too, great. But if not, regular direct DB access through SQL or whatever. -Rwv37 (talk) 04:39, 16 February 2022 (UTC)
 * Sounds like External Data Extension is what you are looking for. I use it in addition to Cargo to pull of data of external MariaDB and display it. Of course on the MariaDB is restricted access and only reads are possible with External Data. Brabi81 (talk) 06:13, 16 February 2022 (UTC)
 * Thanks! I'll check it out. -Rwv37 (talk) 06:18, 16 February 2022 (UTC)

Field type "Wikitext string" missing?
There should be field type "Wikitext string", see.

I am using latest 3.1 version & Page Forms and it seems that no such type exists. Is it bug or feature? :-) And if feature, what is an alternative for short text in wikiformat?

--Radouch (talk) 16:40, 19 February 2022 (UTC)


 * I only ever use Text and String (maybe I should use their wikitext alternatives). Their contents are displayed properly (e.g. bold text) in content pages/queries, but displayed as raw wikitext (e.g. bold text ) on the Special:CargoTables page. Jonathan3 (talk) 00:17, 20 February 2022 (UTC)


 * The "Wikitext string" type has existed for a long time, but it wasn't showing up in Page Forms' Special:CreateTemplate and Special:CreateClass (I assume that's what you are referring to) due to a bug in Cargo - I just checked in a fix for it. Yaron Koren (talk) 04:36, 21 February 2022 (UTC)

Use MATCHES in query and template format
When I use the table format, it shows a relevant extract.

When I use the template format, the  field displays the WHOLE page!

Is there something I need to do to fix this? Thanks. Jonathan3 (talk) 22:38, 24 February 2022 (UTC)

Display internal Cargo errors when invoking #cargo_store?
There are some bugs lurking somewhere in my chain of templates that eventually lead to a call to #cargo_store. However, these are always very tedious to debug because the errors don't seem to be displayed anywhere and are silently swallowed; the only symptom being that the row declared in an article isn't being added to the database.

I seem to vaguely recall that back when I was first setting up Cargo on our wiki, I could run rebuilds of cargo databases from the command line using cargoRecreateData.php and would get errors there that were helpful for debugging, but by now rebuilding the tables takes hours and that's not really an option.

1- is there a way to display the errors that show up on command line from #cargo_store in the wiki UI anywhere? Turning on the following flags didn't include anything useful (lots and lots of junk output, but nothing *useful*): wgShowSQLErrors, wgDebugDumpSql, wgDebugToolbar, wgShowDebug, wgShowExceptionDetails, wgShowSQLErrors

2- Failing that, is there any php script that can be ran on the command line that recreates a single article's data, so that any associated errors can easily be seen?

Thanks! Teltura01 (talk) 19:10, 5 March 2022 (UTC)

Why aren't my calls to working anymore?
I'm working on a query template that will allow entries to any one of 7 fields. In the past, I had this working with a parser call inside the cargo_query call. Now all I get is DB query errors. Here's what I'm doing:

The if parser was only including the where clause if the user had entered something into that field in the query form. The final -pageID>0 was a hack to close any trailing ANDs. This worked like a charm before (and I had to look this solution up on your Talk Archive from 2018 - and it was my solution!) Any reason why the parser if isn't working inside of cargo-query now? May214 (talk) 20:49, 17 March 2022 (UTC)


 * What are the DB error messages you're getting? Yaron Koren (talk) 21:43, 17 March 2022 (UTC)