Extension talk:Cargo

Show all items from yesterday and today, but at least three items from any date
I'd like to do a Cargo query that will:
 * return all items dated "today/yesterday" (maybe 10 or so, depending on the day)
 * if the above would return fewer than 3 results, display older results to make up the number.

I wonder whether I need something like

where the second query returns the max of 3 or the number of items from today/yesterday.

If I find time to work it out then I'll put it here. Otherwise I'd be grateful for any pointers.

Thanks. Jonathan3 (talk) 00:15, 25 January 2021 (UTC)


 * With logic that specific, I would think the only real way to accomplish it is with the Scribunto extension... Yaron Koren (talk) 16:02, 25 January 2021 (UTC)


 * Challenge accepted :-) Jonathan3 (talk) 17:03, 25 January 2021 (UTC)


 * I seem to have got this to work:




 * Hopefully I've included all the relevant parts above. Jonathan3 (talk) 21:52, 25 January 2021 (UTC)


 * Impressive! Does that really accomplish the full set of criteria? Yaron Koren (talk) 15:13, 26 January 2021 (UTC)


 * Thanks. Yes - it does what I wanted it to, as far as I can tell - though maybe I didn’t set it out perfectly above. Jonathan3 (talk) 15:29, 26 January 2021 (UTC)

Cargo and PostreSQL Port
I upgraded from MW 1.31 to MW 1.35 (1.35.1 (13dc141)) and Cargo is also the latest version (2.7.1 (28b4351)). I'm connecting to PostgreSQL 12.4 (Debian 12.4-1.pgdg90+1) with a custom Port set in the LocalSettings.php. The Mediawiki is correctly connecting to it! But it seems Cargo doesn't respect this setting because I get the following error message when I do a query:

Cheers and thank you Brabi81 (talk) 11:08, 26 January 2021 (UTC)


 * Found a fix that worked for me. Hardcoded the port in the open function in the includes->libs->rdbms->database->DatabasePostgres.php of MW. It seems that $this->port is not correctly set or something like when called from Cargo (it returns 0 ...). Brabi81 (talk) 13:36, 1 February 2021 (UTC)

Table can't be created because it was "not declared" despite being declared
On our client's wiki, they have made a template and declared a table at Template:Factory, but the Create/Recreate data tab doesn't appear on the page. Manually navigating to it leads to an empty page.

Then we tried running  to no avail.

Is there a specific maintenance script that we need to run in order to fix this issue? We've already tried running update.php and runJobs.php.

Thank you in advance,

--MyWikis-JeffreyWang (talk) 09:57, 29 January 2021 (UTC)


 * This is very strange. The empty page is actually fine, in a sense - it just means that Cargo doesn't think that template contains a #cargo_declare call. (The display should obviously be better - right now it always does look like an error.) Yes, the template page says that the table is defined, but that's a separate set of code from the code that really determines whether the table has been declared. I don't know why it's failing, though. It might because the table name is lowercase, though I doubt it. I would recommend trying to re-save the page a few times (with at least a small change every time) - maybe it's just a temporary glitch. Yaron Koren (talk) 16:14, 29 January 2021 (UTC)