Extension talk:Cargo

Streamlining uploading images with cargo metadata?
I can upload an image, then on its File page I can include a template that stores some metadata about that image, and later query that template's table in order to create a gallery. However, the manual addition of the template to the File page is tedious and error-prone (e.g. correctly naming other pages in various template fields). Is there an extension, perhaps something like Page Forms, that would allow me to simplify this process, so that I could upload an image and populate its metadata on a single page? Sparr (talk) 01:15, 5 March 2020 (UTC)


 * Yes - Page Forms. :) You should create a form for that template, and then associate that form with the "File" namespace, so that every File page will automatically get an "edit with form" tab when created. Yaron Koren (talk) 17:11, 5 March 2020 (UTC)

Two wikis and one CargoDB
Is it possible to specify the same database for two different wikis?

1) one and the same table is used in the first wiki for recording data and in the second - only for reading.

2) joint filling table. What is the key when writing data (when cleaning old data) - pageName or pageId? Or is it arranged much more difficult? --StasR (talk) 15:35, 5 March 2020 (UTC)


 * I don't think having the same Cargo database for two different wikis will work, even if one is just reading. I believe that, in order to query a Cargo table, a wiki has to know about it - know about its structure, etc. - and that is not possible for an unrelated wiki. Yaron Koren (talk) 18:32, 5 March 2020 (UTC)


 * I declare and create a table in the first wiki. Then I drop the table using SQL command line. Then I declare and create the table in the second wiki. And after that the first wiki writes records to the table. Will it work? --StasR (talk) 09:16, 6 March 2020 (UTC)


 * What about Extension:External Data? Jonathan3 (talk) 18:49, 5 March 2020 (UTC)


 * I have here a lot of tables. The shared table is only one of them. It is convenient to use a single tool. --StasR (talk) 09:16, 6 March 2020 (UTC)

DISPLAYTITLE and Cargo fields with ' in them
The following doesn't work when Title contains an ' character:

The same thing does work when I replace with the text of that field (even if it includes the ' character).

Is this something to do with Cargo's handling of that character? Is there any way to work around this? Thanks. Jonathan3 (talk) 09:18, 6 March 2020 (UTC)


 * Is this a Cargo question? It sounds like just a MediaWiki issue. Yaron Koren (talk) 21:15, 8 March 2020 (UTC)


 * OK I'll ask on the Support desk :-) Jonathan3 (talk) 20:29, 10 March 2020 (UTC)

Drilldown
I have two questions about the charge.


 * In occupations and professions, it is occasionally necessary to use the appropriate term according to the person's gender (male-female).
 * For example King and Queen in English but it is more frequent that distinction in other languages such as Spanish (Senador-Senadora, Presidenta-Presidente, Maestra-Maestro). Currently the same information has been duplicated unnecessarily. There is a solution but it's more focused on categories (somewhat complicated). Could this have a solution in Cargo or not? Maybe it could be used in some way with plurals in Drilldown but I'm not sure (examples: Maestros, presidentes, kings..).


 * I am using List of String but I have noticed that in every word the first letter must be capitalized. The simple solution is that everything should be in lower case but it doesn't fit well in the infobox. Does that have a solution or do I opt for what I said before?

Greetings. --Hispano76 (talk) 19:46, 9 March 2020 (UTC)


 * For the first one, I would say the best solution is to have one value representing each pair, like "Senador" and "Senadora". I don't know how it's usually done in Spanish - "Senador(a)"? Just "Senador"? Whatever you pick, it will be better to have one value than two, even though there are different words for the two.


 * For the second one, I don't understand. Why can't you start words with a lowercase letter? Yaron Koren (talk) 03:09, 10 March 2020 (UTC)


 * It would be fairly easy to save as one value (eg senador) and have gender as a field too, then display the word based on the individual's gender (eg senador/senadora). In Cargo you can have fields starting with lower case letters, so maybe you mean wiki page titles - have a look at Manual:$wgCapitalLinks. Jonathan3 (talk) 10:56, 10 March 2020 (UTC)
 * The answer is visualization. In Spanish after a period for example, the first letter must begin in capital letters. For example in the Infobox of this article it appears like this: Abogado, político, escritor, educador, funcionario público, filósofo, rector. And you'd rather do it that way, isn't that fixable?


 * Capitalisation. Could you maybe use String (with #arraymap??) and the relevant __full Cargo field to capitalise the first letter of the first word in a list? I’m typing on the phone but could elaborate later if it sounds useful. Jonathan3 (talk) 09:09, 12 March 2020 (UTC)
 * hum, it seems interesting but it works with the example I gave?
 * Can you give me an example? It's confusing to me what you're trying to say. About wgCapitalLinks I would prefer not to enable it at this time. --Hispano76 (talk) 01:13, 12 March 2020 (UTC)
 * Let's say that you have a "Person" table with  and you have entered each occupation in lowercase (e.g. abogado, politico, escritor). You then want to show it as a list, with the first item in the list have an initial capital letter (e.g. Abogado, politico, escritor). I can't get   to work with the results of a Cargo query. This seems to work:  . Alternatively, if each string in the list starts with a capital letter, and you want to ensure only the first letter is capital:  . It will display the list delimited by a comma (or whatever delimiter is in the #cargo_declare) - if you want to format it differently (e.g. add   around each string) you'd need to use #array_map. Jonathan3 (talk) 21:13, 13 March 2020 (UTC)


 * Gender. You could have Cargo table Person (with fields occupation and gender), and a separate Occupation table (with male and female versions) - which you’d need to join in a query. Or, maybe better, you could have a single Person table with an extra hidden field for the female version if relevant (ie a female lawyer would have occupation=abogado and also female occupation=abogada) - so you could use #if to decide whether to display the male version or it’s female equivalent, while the Drilldown page and search would still use the same word for everybody. Jonathan3 (talk) 09:17, 12 March 2020 (UTC)
 * hum. I would need an example because it's confusing to me because of the language difference. --Hispano76 (talk) 20:10, 12 March 2020 (UTC)
 * Voy a hacerlo pronto :-) Jonathan3 (talk) 17:32, 13 March 2020 (UTC)
 * In the #cargo_declare for the Person table in Template:Person you would have . In Form:Person you'd have a note saying only to use Occupation_female if the person is female (but still to use the main Occupation field in all cases). In Template:Person you would have something like  . Special:Drilldown would ignore Occupation_female because of the "hidden" parameter, so you'd search on the male occupation title for everybody. This is just one way that sprang to mind. I imagine there's an accepted way of doing it in Spanish!
 * Alternatively, you could have a separate Template:Occupation declaring an Occupations table with . On Form:Occupation you'd enter Male as abogado, Female as abogada, and the same for all the professions used. On the Person template you would only have Occupation defined (no Occupation_female). But when displaying Occupation: in Template:Person you'd add an extra Cargo query like  . I realise I've complicated it by using the word Occupation so many times... and this is from memory so I may have got the syntax wrong. I hope I've not sent you barking up the wrong tree. Jonathan3 (talk) 21:26, 13 March 2020 (UTC)
 * I'm afraid to say that none of them worked. I tried various ways with your examples --Hispano76 (talk) 00:14, 14 March 2020 (UTC)
 * I guess the only way would be a hidden parameter (|ocupaciónCargo=). That would solve the gender by transforming them into plurals (Senadora, Senador=Senadores). We're still missing the caps that didn't work.   --Hispano76 (talk) 00:43, 14 March 2020 (UTC)
 * I think I know what you mean (plurals of masculine and feminine nouns in Spanish are the same). Could you cut and paste what you've tried and what happens? Jonathan3 (talk) 15:56, 15 March 2020 (UTC)
 * Go on, cut and paste the relevant parts of the template here :-) Jonathan3 (talk) 13:54, 16 March 2020 (UTC)

Maintenance script errors
The scripts in the maintenance directory all give errors: > php cargoRecreateData.php 1Recreating data for Cargo table demo in 5 seconds... hit [Ctrl]-C to escape. Deleting and recreating table... [2c20ef2c94d1d167c49639b2] [no req]  Error from line 557 of /var/www/html/extensions/Cargo/includes/CargoUtils.php: Call to a member function tableExists on null Backtrace:
 * 1) 0 /var/www/html/extensions/Cargo/maintenance/cargoRecreateData.php(101): CargoUtils::recreateDBTablesForTemplate(string, boolean, string)
 * 2) 1 /var/www/html/extensions/Cargo/maintenance/cargoRecreateData.php(69): CargoRecreateData->recreateAllDataForTable(string, boolean)
 * 3) 2 /var/www/html/maintenance/doMaintenance.php(99): CargoRecreateData->execute
 * 4) 3 /var/www/html/extensions/Cargo/maintenance/cargoRecreateData.php(161): require_once(string)
 * 5) 4 {main}

> php setCargoFileData.php 1[145ec0515a167c688c084ec1] [no req]  Error from line 34 of /var/www/html/extensions/Cargo/specials/CargoDeleteTable.php: Call to a member function begin on null Backtrace:
 * 1) 0 /var/www/html/extensions/Cargo/maintenance/setCargoFileData.php(62): CargoDeleteCargoTable::deleteTable(string, boolean, boolean)
 * 2) 1 /var/www/html/maintenance/doMaintenance.php(99): SetCargoFileData->execute
 * 3) 2 /var/www/html/extensions/Cargo/maintenance/setCargoFileData.php(103): require_once(string)
 * 4) 3 {main}

php setCargoPageData.php 1[d4f8828a2b4c75c981e8cf15] [no req]  Error from line 728 of /var/www/html/extensions/Cargo/includes/CargoUtils.php: Call to a member function begin on null Backtrace:
 * 1) 0 /var/www/html/extensions/Cargo/maintenance/setCargoPageData.php(79): CargoUtils::createCargoTableOrTables(NULL, Wikimedia\Rdbms\MaintainableDBConnRef, string, CargoTableSchema, string, integer)
 * 2) 1 /var/www/html/maintenance/doMaintenance.php(99): SetCargoPageData->execute
 * 3) 2 /var/www/html/extensions/Cargo/maintenance/setCargoPageData.php(103): require_once(string)
 * 4) 3 {main}


 * What version are you running of MediaWiki and Cargo? Yaron Koren (talk) 12:52, 13 March 2020 (UTC)

Querying data
In case of doubt, I am reworking the "Persona" template for several reasons and for better organization because there are more than 20,000 articles that would use a single table.

I would like to see a separate table, with articles from people born in a certain country, for example Mexico (using the same template "Persona" and not another one; unless it is not possible). I have seen that the Where parameter of #cargo_query has a similar function but I would like to get more information and if that is possible.
 * Example :

I preferred to ask instead of testing if it worked, this to avoid causing any errors. I couldn't find a wiki that used that feature either. How could I configure it to do this? --Hispano76 (talk) 23:05, 14 March 2020 (UTC)


 * I doubt you can get this to work. If you want separate tables, you need to have separate templates. But what's the problem with having a table with 20,000 rows? Yaron Koren (talk) 14:45, 15 March 2020 (UTC)
 * I understand. There's no problem with quantity, but it seemed more organized in a different division. But if that's too much work, then it'll be in the current form. --Hispano76 (talk) 15:32, 15 March 2020 (UTC)

Date error: 1970-01-01
''Oh, I forgot to mention. For some reason, if you don't fill in, 1970-01-01 will appear, the same thing happens if you add " ". I tried this code: but it didn't work. I could convert "Date" to "String" but that would eliminate the chronology and photos function (one of the reasons why I chose Cargo). I don't remember this happening before. What did I do wrong? By the way, it's almost the same code as the one above with some differences. --Hispano76 (talk) 20:29, 15 March 2020 (UTC)''
 * I don't know, but you should create separate sections for separate problems. Yaron Koren (talk) 21:02, 15 March 2020 (UTC)
 * For example: code and display. This appears if you do not add anything to the "Birth/Decease" parameter in an item that uses the Person template. --Hispano76 (talk) 21:43, 15 March 2020 (UTC)
 * Your #if statement should work. I've tried out  and it works fine, and an empty  on its own shows blank. Maybe it's the accented characters (though it shouldn't be that)? But this problem rings a bell from the past... I wonder if you are using an old version of MediaWiki and/or Cargo. Jonathan3 (talk) 22:54, 15 March 2020 (UTC)
 * Um, so it's weird. I have version 2.4 of Cargo (bd152ef; 13 ene 2020) and version 1.34 of Mediawiki --Hispano76 (talk) 23:26, 15 March 2020 (UTC)
 * I'm on MW 1.31.1 and Cargo 2.4 (01e9645) so am at a loss. Maybe it's something to do with the input type you are using in your form (i.e. maybe it is saving Unix 0 time 1/1/70 if it's left blank)? I use the standard date input type, not the datepicker. Jonathan3 (talk) 13:53, 16 March 2020 (UTC)
 * I didn't use Page Froms when creating the Person template because it's easier for me to modify it manually. Anyway I use the "Date" for the year numbers.  --Hispano76 (talk) 18:50, 16 March 2020 (UTC)
 * hum, that date always appears even if you leave the parameter  empty or add the word " " in an article or in the template itself with the   P.S. That's also the case with my other wiki. --Hispano76 (talk) 19:14, 16 March 2020 (UTC)
 * If you cut and paste your entire template and form, then the cause of your problems may become clear! Jonathan3 (talk) 20:47, 17 March 2020 (UTC)

The year 2099
I wanted to mark an event as postponed (date TBC) by changing its date to 9/9/99 but although PF saves this OK to to the wikipage as |Date=2099/09/09 it shows up on the form as if it were blank. Strangely enough it appears on Special:Drilldown as 1/1/70 and this is how it is displayed on Special:CargoQuery... What's up? When I change it to 1 Jan 2030 it works fine. Thanks. Jonathan3 (talk) 15:14, 17 March 2020 (UTC)


 * This sounds like two different issues. For the Cargo issue - is the wikitext value still currently "2099/09/09"? If so, what shows up in "action=pagevalues"? Yaron Koren (talk) 20:08, 17 March 2020 (UTC)


 * I changed it back to do this.  (same for 2099/09/09) gives   using "action=pagevalues". Jonathan3 (talk) 20:45, 17 March 2020 (UTC)


 * That's strange - I don't get that problem. I wonder if this is an issue in the PHP version, OS, database etc. you have, maybe related to the "year 2038 problem"? Yaron Koren (talk) 21:47, 17 March 2020 (UTC)


 * OK, I'll look into that and report back. Jonathan3 (talk) 22:09, 17 March 2020 (UTC)

Problem with list-type field names and values

 * Table declaration: https://wikisandbox.gamepedia.com/Template:CargoListBug/CargoDec

So here we make a list-type field called "Blah"

Now here we store the value  into the other field. Then we try to query it. Now it's somehow thinking we're trying to query the field Blah, rather than the value Blah in field OtherField.

And in fact even when the value is, it still thinks we're querying the list-type field somehow.

Found this as an issue because a tournament has the word "Tournaments" in its name ("H3LL Tournaments/2020 Season") and I have a list-type field in a table ExternalContent.Tournaments. I'll workaround it by renaming the field for now but this seems like potentially a pretty big issue. --RheingoldRiver (talk) 00:49, 19 March 2020 (UTC)